In SQL Server 2005 and above, you can do this:
SELECT TOP (@topparam) * from table1
Related Contents:
- SET NOCOUNT ON usage
- DateTime2 vs DateTime in SQL Server
- How do I split a delimited string so I can access individual items?
- SQL Server SELECT into existing table
- Is there a combination of “LIKE” and “IN” in SQL?
- How do I obtain a Query Execution Plan in SQL Server?
- SET versus SELECT when assigning variables?
- SQL Server SELECT INTO @variable?
- Why do you create a View in a database?
- Syntax of for-loop in SQL Server
- How do you return the column names of a table?
- Need to list all triggers in SQL Server database with table name and table’s schema
- I want to use CASE statement to update some records in sql server 2005
- How to update two tables in one statement in SQL Server 2005?
- Referring to a Column Alias in a WHERE Clause
- A table name as a variable
- Better techniques for trimming leading zeros in SQL Server?
- Remove the last character in a string in T-SQL?
- T-SQL split string
- GRANT EXECUTE to all stored procedures
- Compare DATETIME and DATE ignoring time portion
- SQL Server equivalent to MySQL enum data type?
- WITH CHECK ADD CONSTRAINT followed by CHECK CONSTRAINT vs. ADD CONSTRAINT
- SQL Server ‘:setvar’ Error
- Export database schema into SQL file
- sql primary key and index
- TSQL – How to use GO inside of a BEGIN .. END block?
- Printing integer variable and string on same line in SQL
- SQL Server table creation date query
- How can I have multiple common table expressions in a single SELECT statement?
- is there an advantage to varchar(500) over varchar(8000)?
- How can I get the number of records affected by a stored procedure?
- Why use Select Top 100 Percent?
- SQL “select where not in subquery” returns no results
- Inserting rows into a table with one IDENTITY column only [duplicate]
- Add row to query result using select
- SQL Server replace, remove all after certain character
- Text was truncated or one or more characters had no match in the target code page including the primary key in an unpivot
- Common Table Expression, why semicolon?
- SQL Server 2005 Using DateAdd to add a day to a date
- What kind of datatype should one use to store hashes?
- How to add plus one (+1) to a SQL Server column in a SQL Query
- Alter user defined type in SQL Server
- Determine a table’s primary key using TSQL
- Why do I get “A cursor with the name already exists”?
- Drop default constraint on a column in TSQL
- How do I compare two columns for equality in SQL Server?
- Sort by minimum value of two columns
- How to add a Try/Catch to SQL Stored Procedure
- MS SQL Date Only Without Time