on 02-11-2014 10:45 AM
Hi All,
I have a requirement to generate the dynamic select statement . Procedure will accept the table name and schema name as parameters and return the select statement.
I could able to get the column names from sys.columns table. How to loop through the rows and concatenate the column values into single string?
Regards,
Suman.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Suman,
I guess you are working on replicating procedure, if am not wrong.
You can use a cursor to achieve it. You can open a cursor to read the columns even from a table TABLE_COLUMNS and then loop and concatenate them into a single string to form you insert or update query.
Regards,
Krishna Tangudu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.