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 - 2006-08-08 : 07:37:25
|
padmanaban writes "my procedure is--=================================CREATE PROC spProc (@dtDate as datetime,@Ids as varchar(100)) ASSELECT * FROM test WHERE Sid IN (@ids)--==================================Sid Column in the table Test is Numeric(9) Datatypemy problem is if i execute proc like this its show the errorexec spProc '04/01/2006','131,132'error msg: error converting datatype nvarchar to numericbut at the same time below code is working fineexec spProc '04/01/2006','131'how its work? and how can i retrieve the data for muliple sids?" |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-08-08 : 08:55:09
|
[code]CREATE PROC spProc (@dtDate as datetime,@Ids as varchar(100))ASdeclare @sql varchar(8000)select @sql = 'SELECT * FROM test WHERE Sid IN (' + @ids + ')'exec (@sql)[/code] KH |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-08-08 : 12:48:14
|
orWhere ','+@ids+',' like '%,'+cast(id as varchar(20))+',%MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|