sa.ordekci
Ten Centuries
Points: 1177
More actions
January 13, 2012 at 3:59 am
#266429
Hi.
i have two database on sql server. Can i write a view that uses two database. So, it takes a table on one db, and another table from other db.
Thanks in advance.
Patrick_Fiedler
SSCommitted
Points: 1904
January 13, 2012 at 4:01 am
#1433129
Hi,
you can use the full name of the tables of the different databases in your view select statement.
select * from [database].[dbo].[tablename]
[font="Arial"]Kind regards,
Patrick FiedlerConsultant
www.fiedler-sql-consulting.de[/font]
John Mitchell-245523
SSC Guru
Points: 148809
January 13, 2012 at 4:45 am
#1433137
Beware of issues with permissions caused by ownership chaining when writing cross-database views. This Microsoft article is worth reading.
John
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply