Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I Have 5 Database like SR_DB1,SR_DB2,SR_DB3,SR_DB4, SR_DB5
all of their Have the same table : tblStudent(ID,Name,Sex)
My Problem is i wanna get Databases Name , And Name from tblStudent of all Database
I want it display like this
SR_DB1 Name = --Something
SR_DB2 Name = --Something
SR_DB3 Name = --Something
SR_DB4 Name = --Something
SR_DB5 Name = --Something
Posted

1 solution

SQL
SELECT Name FROM SR_DB1.dbo.tblStudent WHERE ID = somevalue

to format your output you can use following in select query instead of Name
SQL
'SR_DB1 Name = ' + Name

repeat select query for other four databases.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900