Bartłomiej Sobieszek
Bartłomiej Sobieszek

Reputation: 2800

params[] in TSQL procedure?

Can I force the procedure to use array of parameters?

Something similar to Console.WriteLine(String msg, params[]) in C#

I need it to pass column names of table in procedure, something similar to INSERT INTO operation, but need to pass n arguments

Upvotes: 0

Views: 78

Answers (1)

M.Stoop
M.Stoop

Reputation: 119

As said above, a Table Valued Parameter is probably your best option here.

I've also had some success with XML parameters (might be easier to generate from C#, depending on the host), and allows some more complexity on the parameter side.

Before SQL 2008, I used pipe (|) separated strings and a string splitter function, which also work fine.

Upvotes: 1

Related Questions