db042188


I'm getting an error trying to add an sp that selects top @varname...I'm surprised since variables are typically allowed in t-sql selects.

Is this by design or am I doing something wrong Do I have to build the select dynamically to accomplish this




Re: cant add stored proc with "select top @varname..."

Kent Waldrop Oc07


In SQL Server 2005, this seems to work:

Code Block
select top (@varname) columnName from aTable

but this does not seem to work:

Code Block
select top @varname columnName from aTable

Neither seem to work in SQL Server 2000.