June 21, 2007 at 9:34 pm
Is there a way to easily get this information using TSQL or do I have to create an Active X vbscript and run that as a job. Thanks for your help in advance.
June 21, 2007 at 10:44 pm
Search this site for a vbs script that has been already posted that will give you a list of all user databases in an excel format for multiple servers/instances.
Cheers,
Sugeshkumar Rajendran
SQL Server MVP
http://sugeshkr.blogspot.com
June 21, 2007 at 10:48 pm
I found an example that works as a vbscript to run but I want to put this into a T-SQL statement. There don't appear to be examples that do this.
Dim oDBConnect,sQuery,oRecordSet
'WScript.Echo sServerName
Set oDBConnect = CreateObject("ADODB.Connection")
oDBConnect.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=" & sServerName
sQuery = "select * from sysdatabases"
Set oRecordSet = oDBConnect.Execute(sQuery)
oRecordSet.MoveFirst
While Not oRecordSet.EOF
wscript.echo oRecordSet("Name")
oRecordSet.MoveNext
Wend
Set oRecordSet = Nothing
Set oDBConnect = Nothing
June 21, 2007 at 11:35 pm
Start with OSQL -L
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 4 (of 4 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