General information
Forum:
Microsoft SQL Server
What is the equivalent of VFP's macro substitution in a SQL Server stored procedure?
I want to pass a parameter to a stored procedure and use this parameter to order a SELECT statement. If I pass the name of a field to the parameter @cOrder and add
ORDER BY @cOrder
to the SELECT statement I get Error 1008:
The SELECT item identified by the ORDER BY number 1 contains a variable as part of the expression identifying a column position. Variables are only allowed when ordering by an expression referencing a column name.
Thanks in advance.
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only