January 13, 2012 at 3:59 am
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.
January 13, 2012 at 4:01 am
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 Fiedler
Consultant
January 13, 2012 at 4:45 am
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
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy