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 |
rudba
Constraint Violating Yak Guru
415 Posts |
Posted - 2010-10-19 : 16:15:43
|
I have multiple dbs with same table structure,how do i store dbname and no of record on that table in #table.select [name] as DbName from sys.databases where [name] not in ('master','model','testdb')insert into dbName.dob.tblName (Db_Name,No_Record) values (<databasename>,<no_of_record>) |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
rudba
Constraint Violating Yak Guru
415 Posts |
Posted - 2010-10-19 : 19:15:51
|
DB_name() always return same dbname,e.g i have following dbs with same table structuresdb01db02db03db04d05i tried to instert the follwing script in loop,insert into testdb.dbo.tblDbRecord (db_name,no_of_record) select db_name(),count(*) from <db_name_from_loop>.dbo.tbl01 |
 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|