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 |
|
JLW
Starting Member
1 Post |
Posted - 2004-10-08 : 00:48:28
|
| Hi all,I would like to pull data from, say database1, into a view on database2 combined with data from database2. They are both running on the same SQL Server. Is this possible and how would I go about doing this?Thanks! |
|
|
hgorijal
Constraint Violating Yak Guru
277 Posts |
Posted - 2004-10-08 : 00:52:42
|
| use database2gocreate view my_view as select * from database1.dbo.my_db1_tableHemanth GorijalaBI Architect / DBA... |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2004-10-08 : 00:54:30
|
| You can select from another database using a 3 part syntax : database.owner.object. For example : Select * from Northwind.dbo.Products.So your view could be :Create View vwTestASSelect col1, col2 FROM db1.dbo.customersUNION ALLSelect col1, col2 FROM db2.dbo.customersGOHope that helpsDamian |
 |
|
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2004-10-08 : 00:55:06
|
Damn, he beat me to it Damian |
 |
|
|
|
|
|