469,898 Members | 1,611 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

views from different database

5
just want to ask, is it possible to create views in which i will join tables from two different database? how?
Sep 11 '07 #1
3 2681
ck9663
2,878 Expert 2GB
just want to ask is it possible to create views i which i will join tables from two different database? how?

yes.

create your query first. then create it as view. if you need to change any part of the query (table, where condition) based on some parameter, a function returning a table would be better.
Sep 11 '07 #2
mayo
5
yes.

create your query first. then create it as view. if you need to change any part of the query (table, where condition) based on some parameter, a function returning a table would be better.
i mean combining data from multiple database? whats the syntax?
Sep 11 '07 #3
ck9663
2,878 Expert 2GB
i mean combining data from multiple database? whats the syntax?

yes...name your table properly....dbname.ownername.tablename

Expand|Select|Wrap|Line Numbers
  1. create view myview
  2. as
  3.  
  4. select table1.field1, table2.field2 
  5. from db1.dbo.tablel1
  6. inner join db2.dbo.table2 on table1.key = table2.key
  7.  
  8. go
i did not the syntax on this command...but i hope you got the ideae
Sep 11 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Marko Poutiainen | last post: by
3 posts views Thread by jimstallings | last post: by
3 posts views Thread by Damon | last post: by
33 posts views Thread by Peter | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.