I am working on small module in which we pass the column name as comma-separated string to a stored procedure. In the stored procedure, we want to separate the column names out.
Sql-server – How to split the comma separated list in the stored procedure
sql serversql-server-2005stored-procedurest-sql
Related Question
- Sql-server – Create/Alter stored procedure without compiling
- Database-agnostic stored procedure call passing array of name/value pairs
- Mysql – Loop through comma separated values
- Sql-server – Passing comma separated values to parameters in stored procedure
- T-sql – Way to obtain full list of column dependencies for stored procedure
- MySQL LIKE IN with Input Parameter of stored procedure Comma Separated Values
Best Answer
The definitive article on the topic is Arrays and Lists in SQL Server 2005 and Beyond which contains code and performance test results for a variety of split functions.
You say these are column names? You should probably read another of Erland's articles on The Curse and Blessings of Dynamic SQL where he discusses both SQL injection and when dynamic SQL is a good idea.