|
i able to execute
it executed for all databases but
it executes only for master database or if i specified database name in connection string it executes only for the specified database. what could be the solution to execute the second query in all databases? Thanks in advance.. Kumar
(comments are locked)
|
|
Try:
Edit I tried it but problem still exists. and i could not find any difference between yours and mine. if you mention the changes you done it will more useful to me to understand. Thanks to Fatherjack for your quick reply. – Kumar V
May 27 '10 at 07:31 AM
Kumar V
my version has USE [?]; in it
May 27 '10 at 08:03 AM
Fatherjack ♦♦
Now i am getting the syntax error like Msg 156, Level 15, State 1, Line 4 Incorrect syntax near the keyword 'USE'. Msg 911, Level 16, State 1, Line 4 Could not locate entry in sysdatabases for database '?'. No entry found with that name. Make sure that the name is entered correctly.
May 27 '10 at 08:10 AM
Kumar V
And I corrected and tried. but problem not solved. i changed the code like ?..SYSINDEXES (NOLOCK) but no use.
May 27 '10 at 08:14 AM
Kumar V
@FatherJack you're on the right track. You just have to get the USE command to work. It's the context that matters. Instead of [?] try wrapping it in quotes, doubling as necessary to get '?'.
May 27 '10 at 08:17 AM
Grant Fritchey ♦♦
(comments are locked)
|
|
OK, does this give you the results you want? yes.. works well
May 27 '10 at 08:47 AM
Kumar V
if i do not use USE [?], i am getting results but the changes are only in dbnames but all other columns are from master database only. i.e. i am getting 6 rows for every database which is the result of master database.
May 27 '10 at 08:57 AM
Kumar V
so execute it with "USE [?];"
May 27 '10 at 09:24 AM
Fatherjack ♦♦
Yeah, you have to have the USE statement to get it to switch database context.
May 27 '10 at 09:30 AM
Grant Fritchey ♦♦
Please forgive me to disturb you. i tried it immediately as you replied but no use. still it return only 6 rows which is the result of master database.
May 27 '10 at 10:15 AM
Kumar V
(comments are locked)
|


any reason why this is a community wiki question?
no, and I can't seem to change it back???