Set Limit for a Table Rows In SQL

前端 未结 4 625
感情败类
感情败类 2020-12-03 12:57

I want to set the limit for my table\'s rows. How can I do it?

For example 50 rows in my table.

4条回答
  •  旧时难觅i
    2020-12-03 13:33

    Are you referring to limiting the results of a query?

    If so, with SQL Server 2008 you can use TOP

    SELECT TOP 50 *
    FROM Table
    

    If you're looking at actually limiting the amount of records in the database table, then an IF statement in a TRIGGER, like @Shark has posted, would be my solution.

提交回复
热议问题