Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
i am passing values to stored procedure from .net through command parameters.when i pass values likestring City="'Lucknow','Kanpur'";Com.Parameter.AddWithValues("@Cities",City);create procedure SPGetState@Cities varchar(2000)AsSelect * from Temp Where City in(@Cities)i can't get the result.But i run this in Sql Query Analyzer ,i get the result.What;s the problem,i can't find................alokgupta
YellowBug
Aged Yak Warrior
616 Posts
Posted - 2009-09-15 : 07:08:09
Have a look for a function to convert a delimited string into a table, e.g.http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htmWhen this query is run in SQL Server it looks like this:Select * from Temp Where City in("'Lucknow','Kanpur'")And because there is no city called by that entire string, it returns nothing.
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2009-09-15 : 08:26:03
Also search for Array+SQL Server in googleMadhivananFailing to plan is Planning to fail