|
Posted by Hugo Kornelis on 06/27/05 20:42
On 27 Jun 2005 08:22:10 -0700, Mark wrote:
>
>Hi everyone,
>
>I just need a bit of advice as to where to start tackling a problem, if
>thats possible - thanks very much.
>
>I need a single stored procedure to make several inserts into my msde
>database. There will be two arguments to the stored proc. The first
>is a title argument which needs to be inserted into the first table
>after which the autonumbered primary key is captured with @@identity.
>
>The second argument is a delimited list of foreign keys which need to
>be inserted into the second table along with the new key from the first
>statement. This table is a link table with two columns - both foreign
>keys - ie its the link table in a many to many relationship.
>
>My problems is that as far as I know I can't use arrays in sql server
>cause it doesn't support them. And this has come about because I don't
>know how many rows need to be inserted into the link table. But there
>will always be at least one.
>
>I know I need to do this in a loop, but how do I split up the the
>second argument so that I can?
>
>Thanks,
>
>Mark
Hi Mark,
Check out this site for a wealth of possible solutions:
http://www.sommarskog.se/arrays-in-sql.html
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
Navigation:
[Reply to this message]
|