June 30, 2013 at 11:38 am
Hi All,
I have in the past created dynamic SQL in a tally table and looped through to execute it. This is probably not best practice but what alternatives are there, apart from cursors and/or while loops that could be used in this instance?
Thanks for your thoughts
SQL DBA
Every day is a school day, and don't trust anyone who tells you any different.
http://sqlblogness.blogspot.co.uk
June 30, 2013 at 11:53 am
Depends. What are you trying to do?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 30, 2013 at 12:14 pm
Hi Gail - Hope you are well.
I spoke to you at SQL in the City In London a week or so ago (i was the one with the questions after the 'life in the day of a dba' talk on the Friday re: the windows double hop authentication issue - Good talk BTW, I recognised a lot of my day to day life.
I sometimes have the need to run some scripts such as DBCC [x] or provide a stored procedure with a list of values to run (using existing Sproc that adds does some calcs, so I need to provide the parameters that I have obtained and put into a temp table) . I know that it would be best to achieve this via a set based method but have yet to arrive at it. Any ideas (set based, that is)?
Thanks, Elliot
SQL DBA
Every day is a school day, and don't trust anyone who tells you any different.
http://sqlblogness.blogspot.co.uk
July 12, 2013 at 11:07 am
Have you considered using the SSIS execute sql task? You can map parameters to it. If you need to do many somewhat independent things as a batch, add them as a steps in one job in sql server.
----------------------------------------------------
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy