Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Haz
Starting Member
38 Posts |
Posted - 2009-01-08 : 02:10:04
|
| Hi there,does anyone know how to get database nameFor example:DBName CustNo CustNamedb1 Cust1 CustAdb1 Cust2 CustBdb2 Cust1 CustAdb2 Cust2 CustBdb3 Cust1 CustAi already try SELECT DB_NAME() AS [Current Database];but they display the same db name..anyone has idea how get it?Thanks.. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2009-01-08 : 02:35:10
|
| Wat U want to ask ........Specify which database name u want to get in your results? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-08 : 02:36:26
|
| do you mean you need to display all db's data from your server along with dbname? |
 |
|
|
Haz
Starting Member
38 Posts |
Posted - 2009-01-08 : 02:41:50
|
| can all of u go to this link...maybe u will understand what i try to tell u..sorry make u confius..http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=115552 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-08 : 02:46:08
|
| [code]SELECT 'db1' AS DBName,field FROM db1..tableUNION ALLSELECT 'db2',field FROM db2..tableUNION ALLSELECT 'db3',field FROM db3..table[/code] |
 |
|
|
|
|
|