Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
srad
Starting Member
39 Posts |
Posted - 2001-08-15 : 10:38:03
|
| Hello this is my first post so i hope that i supply you with enough information.I am trying to write a sp that selects from one of two cols depending on the lengthof the input param. The variable @codetype stores the name of the column that i wantto select from. Here's the snippit of code that's not working..declare @codetype char(8)select @codetype = 'column name'SELECT COUNT([column name]) FROM [table name] WHERE @codetype = valuei get the following errorServer: Msg 245, Level 16, State 1, Line 3Syntax error converting the varchar value 'column name' to a column of data type int.When i add a print statement to the code it returns the name of the column i want toquery from.Hope you can help. |
|
|
|
|
|