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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Stored Procedure help needed

Author  Topic 

beady
Starting Member

28 Posts

Posted - 2007-04-04 : 21:48:30
Hello,

The table set up is as follows:
A_tbl
idA
FK idF

B_link_tbl
FK idA
idB

Where B_link_tlb is related to C_tbl by idB and idC

C_tbl
idC

D_link_tbl
FK idA
idD

Where D_link_tlb is related to E_tbl by idD and idE
E_tbl
idE

F_tbl
idF

There will be variable numbers of input parameters for idC and idE. eg. idC=2, idC=3, idC=23 up to about 5 or six variables. Similarly for idE.

OR there will be input parameters for idE but not for idC or vice versa.

But there will always be one input for idF and at least one of idC or idE.

Question: how do I write the stored proc in such a way that it can handle variable input parameters as described?

The inputs will come through an asp.net interface and will be returned to an asp.net page.

Thanks for helping.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-04-04 : 21:56:41
you can pass in the value as CSV (comma separated value)
for example '2,3,23' and use function CSVTable to parse it

CSVTable can be obtained from http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=25830&SearchTerms=CSVTable

Also take a look here http://www.sqlteam.com/item.asp?ItemID=637


KH

Go to Top of Page

beady
Starting Member

28 Posts

Posted - 2007-04-04 : 23:37:59
Thanks for the suggestion,KH, I'll keep it in mind.

I wonder, though, if the cvs approach is the simplest or only way to go about it?

It looks messy and so very prone to get buggy.

Any other approaches?
Go to Top of Page
   

- Advertisement -