November 10, 2006 at 8:05 am
I tried searching, but perhaps I didn't use the correct terms to find my answer, so here's my question.
I have SQL that creates a batch of SQL statements I want to execute (stored procedures and SQL). How would I go about doing this in SQL Server? I'm new to SQL Server, but have coded scripts like this in Perl on Unix.
Thank you in advance for your help.
November 10, 2006 at 8:46 am
Are you trying to execute code via a scheduled task?
November 10, 2006 at 8:46 am
Have a look in books online for xp_execresultset, you could also search this site, it has some examples of how to use this.
November 10, 2006 at 8:51 am
Thanks, I'll try searching on xp_execresultset. I really don't know what to search on, and tried things like "execute sql results" but didn't find what I was looking for.
Ideally, yes, scheduled task would be great. I'm wanting to automate changing the owner of some views. I have a SQL statement to get the sp_changeobjectowner commands formatted for the views who need their owner changed, but it's just executing those results is where I've run into a roadblock.
I did find some cursor action syntax on this forum that I'm going to try next to see if that will get me down the correct path.
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply