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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-09-10 : 08:38:08
|
| Richard writes "In a MS SQLServer 7.0 stored procedure I'm trying to get the @IDList variable to be recognized as a list of productids which are of type int. The sample below returns the following error:Syntax error converting the varchar value '1,2' to a column of data type int. Any Suggestions? Declare @Counta int Declare @IDList varchar(5000)SET @IDList = '1,2'print @IDListSELECT @Counta = COUNT(*) FROM vSomethingWHERE ProductID in ( @IDList ) AND InfoBPID = 1 AND AppUserID = 76Print @Counta" |
|
|
Seventhnight
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2004-09-10 : 08:45:57
|
| [code]Declare @Counta int Declare @IDList varchar(5000)SET @IDList = '1,2'print @IDListSELECT @Counta = COUNT(*) FROMvSomethingWHERE(','+@IDList+',') like '%,'+ProductID+',%' ANDInfoBPID = 1AND AppUserID = 76Print @Counta[/code]Corey |
 |
|
|
|
|
|