Tuesday, April 22, 2008

It's always nice to learn something new

A co-worker recently introduced me to sp_MSforeachtable system stored procedure in SQL Server. I was suprised to find that it has been available for years and I am just now figuring that out. I usually use a cursor to iterate through tables using system objects but I think that this would be much easier to use. As an undocumented stored procedure, I knew that this was a "use at your own risk" but I thought I'd do a little research anyway on the proc to see what kind of things people are doing with this proc and found this forum

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2920286&SiteID=1

stating that sp_MSForEachDb and sp_ForEachTable are both on the deprecation list. Too bad. I wonder what they will replace these procedures with.

No comments: