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 |
|
Mits
Starting Member
48 Posts |
Posted - 2005-05-05 : 07:56:54
|
| this is my stored procedureCREATE PROCEDURE sp_Test_FOR_InStatement@sStr as char(50) ASset @sStr = rtrim(@sStr)select * from a2zOrderdata where [Order No] in (@sStr)GOi pass in this values to stored procedure '146767,142359,146743' and i get Error converting data type varchar to int. as error messge.[Order No] is a numeric Field.Any idea, suggestion would be really appreicated.Mits |
|
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-05-05 : 08:02:56
|
| IN @MyParmis not supported. Search this forum, this question has been answered many times. |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2005-05-05 : 08:48:34
|
| It is supported, it just doesn't work the way some people incorrectly expect that it should. Thankfully, SQL does NOT look at the value in that variable and say "hmmm, the string has commas in it ... maybe I should parse it out into multipe values!" . That would be a lot of fun when working with "LastName, FirstName" or "City, State" or "1,234,628" or any other string value with commas in it.However, I do feel there should be an ANSI warning when executing a statement like this that says "Warning: A single value is supplied for an IN() clause; this is the equivalent of using the = operator" or something like that.- Jeff |
 |
|
|
|
|
|