I need to apply a procedure on every record's NVARCHAR(MAX)
field in a table. The procedure will receive a large string and split it into several shorter strings (less than 100 chars). The procedure will return a result set of smaller string. These strings will be inserted into a different table (each in its own row).
How can I apply this procedure in a set-based fashion to the whole table, so that I can insert the results into another table?
I've found some similar questions on SO, however they didn't need to use the INSERT INTO
construct. This means UDF and TVF functions are off the table. EDIT: functions do not support DML statements. I wanted to use INSERT INTO
inside the function.
Alternatively, is there a set-based way of using a stored procedure? SELECT sproc(Text) FROM Table
didn't work.