Comma-separated value insertion In SQL Server 2005

Posted by Asim Sajjad on Stack Overflow See other posts from Stack Overflow or by Asim Sajjad
Published on 2010-04-08T04:38:12Z Indexed on 2010/04/08 4:53 UTC
Read the original article Hit count: 330

Filed under:
|

How can I insert values from a comma-separated input parameter with a stored procedure?
For example:

exec StoredProcedure Name 17,'127,204,110,198',7,'162,170,163,170'

you can see that I have two comma-separated value lists in the parameter list. Both will have the same number of values: if the first has 5 comma-separated values, then the second one also has 5 comma-separated values.

  • 127 and 162 are related
  • 204 and 170 are related

...and same for the others.

How can I insert these two values? One comma-separated value is inserted, but how do I insert two?

© Stack Overflow or respective owner

Related posts about sql-server-2005

Related posts about sql