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 |
|
gdeconto
Posting Yak Master
107 Posts |
Posted - 2002-03-06 : 19:33:46
|
| I was looking at writing a stored procedure that would be referenced from a variety of locations.The problem is that the number of input parameters being passed to the stored procedure is not known ahead of time.ie. the first time the sproc is called, it may have one parameter, the second time it could have twenty parameters.I would use this list of parameters to build a dynamic sql stmt to execute.Any recommendations, aside from giving up?? |
|
|
robvolk
Most Valuable Yak
15732 Posts |
|
|
gdeconto
Posting Yak Master
107 Posts |
Posted - 2002-03-07 : 12:13:00
|
| thx, Rob. it is close to what I need but not quite.after looking at the problem more, realized that I needed to send in a list of keys and their valuesie similar to web URLs such as?param1=value1,param2=value2,param3=value3 etcis there an optimal approach to parsing this lind of list of parameters?? |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-03-07 : 12:35:35
|
| Do you have some code that shows how you use the pairs (any code at all)? I would almost suggest that you could pass the pairs in such a way that they make up part of the SQL statement, then you can dynamically execute it. I can't say for sure because this may not make sense for a SELECT or INSERT statement, but be perfect for an UPDATE or DELETE.Even if that doesn't quite do it, you could modify the CSV parsing to parse out each pair, then parse the name and value, then construct dynamic SQL from the results. |
 |
|
|
gdeconto
Posting Yak Master
107 Posts |
Posted - 2002-03-08 : 11:53:25
|
| yeah, that's the conclusion that I came up with as well.I ended up building the query filter and string in my ASP app and then passing it to sql for execution.thx for the help, dude. |
 |
|
|
|
|
|
|
|