I am trying to run a stored procedure using tsql multiple times in a query using each CSV line for the parameters.
How would I go about looping through this?
Cheers
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If this can be achieved with a set bases operation (as recommended by AnnandPhadke), that is the way to go. Much more efficient. If not you can use a cursor as follows:
Import the csv into a table ImportedCSV
This will allow the execution of custom SQL per line in the CSV, including calling a stored procedure with multiple parameters.