tag:blogger.com,1999:blog-495177919198719500.post6495276363138233620..comments2023-12-27T20:52:29.483-08:00Comments on Microsoft Sql Server Tutorials: How to exclude databases while using the sp_MSforeachdb stored procedureSuprotim Agarwalhttp://www.blogger.com/profile/08349831623922214390noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-495177919198719500.post-70972619915123770042012-10-01T08:31:22.820-07:002012-10-01T08:31:22.820-07:00I want to exclude some staging databses from the l...I want to exclude some staging databses from the list and run the query.... <br /><br />i mean <br /><br />not like '%stg% <br /><br />can we use it in this way so I can exclude the list of staging databases....SAGAhttps://www.blogger.com/profile/11842329826714219336noreply@blogger.comtag:blogger.com,1999:blog-495177919198719500.post-42868943606511495272011-03-14T06:39:19.228-07:002011-03-14T06:39:19.228-07:00Thanks jbraes for the feedbackThanks jbraes for the feedbackMadhivananhttp://beyondrelational.com/blogs/madhivanan/noreply@blogger.comtag:blogger.com,1999:blog-495177919198719500.post-50924986095073809542011-03-14T05:31:30.106-07:002011-03-14T05:31:30.106-07:00madhivana!
Super response you made my day :)madhivana!<br /><br />Super response you made my day :)jbraeshttps://www.blogger.com/profile/05494570278930689644noreply@blogger.comtag:blogger.com,1999:blog-495177919198719500.post-63576793741485638122011-03-02T01:37:03.016-08:002011-03-02T01:37:03.016-08:00Thanks anonymous for the feedbackThanks anonymous for the feedbackMadhivananhttp://beyondrelational.com/blogs/madhivanannoreply@blogger.comtag:blogger.com,1999:blog-495177919198719500.post-42751043548172151432011-03-01T20:55:08.192-08:002011-03-01T20:55:08.192-08:00Wow thanks madhivana! had the same problem, never ...Wow thanks madhivana! had the same problem, never knew you could use the USE statement like that<br /><br />- B. MeyerAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-495177919198719500.post-2320901090251390092011-02-27T22:17:52.353-08:002011-02-27T22:17:52.353-08:00Try this
EXEC sp_MSforeachdb 'USE [?]; EXEC...Try this<br /><br /><br /><br />EXEC sp_MSforeachdb 'USE [?]; EXEC sp_spaceused'Madhivananhttp://beyondrelational.com/blogs/madhivanan/noreply@blogger.comtag:blogger.com,1999:blog-495177919198719500.post-66975478748490356182011-02-25T09:01:05.884-08:002011-02-25T09:01:05.884-08:00Hi I found your info very useful but I am having s...Hi I found your info very useful but I am having some trouble using it with databases using UUID as names.<br /><br />example one database is named 00075926-0f40-41b1-8695-d7ca3fc7f474<br /><br />now when I run a command like<br />EXEC sp_MSforeachdb 'USE ?; PRINT DB_NAME()'<br /><br />I will get an error : Msg 102, Level 15, State 1, Line 1<br />Incorrect syntax near '00075926'.<br /><br />clearly the name of the database . Any Ideas on what I should do ?jbraeshttps://www.blogger.com/profile/05494570278930689644noreply@blogger.com