I need to select status values form 1 of 4 possible columns, and I need to
pass the column name to select on as a parameter to the stored procedure.
Does anyone have an example of the syntax for the stored procedure?
such as:
CREATE PROCEDURE dbo.sp_Document_Select_ByStatus
(
@SelectColumn nVarChar
)
AS
SET NOCOUNT ON;
SELECT *
FROM Documents
WHERE (@SelectColumn = 0)
The columns to select on are BIT columns.
The error message on the above SP is:
'Syntax error converting the nvarchar value 'P' to a column of data type
int.'
At this point, the passed in parameter is a string "ProducerStatus"
Thanks
Michael