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 |
|
kamii47
Constraint Violating Yak Guru
353 Posts |
Posted - 2008-09-01 : 07:10:02
|
| I have a query where my parameter is provided as a string as '1 ,2 ,3' it is used in a In query.The numbers are int identity columns in the database.I have no other way of changing the parameter.But I can change the query.[But parameter is given to me as comma separated string]Follwing is my current querySelect users from tbl1 where userid in ('1 , 2 , 3 ' )which is giving the errorConversion failed when converting the nvarchar value '1 , 2 , 3 ' to data type int.Kamran ShahidSr. Software Engineer(MCSD.Net,MCPD.net)www.netprosys.com |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-01 : 07:23:54
|
| declare @userid varchar(100)set @userid='1,2,3' Select users from tbl1 where ','+@userid+',' like '%,'+cast(userid as varchar(10))+',%'MadhivananFailing to plan is Planning to fail |
 |
|
|
kamii47
Constraint Violating Yak Guru
353 Posts |
Posted - 2008-09-01 : 07:31:07
|
| Thanks it work could u please explain a littleKamran ShahidSr. Software Engineer(MCSD.Net,MCPD.net)www.netprosys.com |
 |
|
|
|
|
|
|
|