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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 VIEW - query on 2 DB's

Author  Topic 

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2007-06-30 : 10:00:10
i want to query 2 db's inside a VIEW.
and i tried to do it the same as in sql server 2000 - but i recive and error
quote:

invalied object name Table1.dbo.UserLastEntrance



this is the code:

SELECT UserName, EntranceTime
FROM dbo.UserLastEntrance
UNION ALL
SELECT UserName, EntranceTime
FROM Table1.dbo.UserLastEntrance AS UserLastEntrance_1

what can i do?
thnks in advance
peleg

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-06-30 : 10:15:43
Table1 must be a database name

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-30 : 10:16:51
Is table1 a database name?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2007-06-30 : 10:33:34
yes i applogize
it should be :
DB1.dbo.UserLastEntrance AS UserLastEntrance_1



Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-30 : 10:40:28
do you have access to the table in DB1 ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2007-06-30 : 10:50:34
sorry my mistake i didn t save the table in its new name
(i renamed it on the properties panel) but it didnt changed (the name)
until i pressed the save butoon

thanks any 1
peelg

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)
Go to Top of Page
   

- Advertisement -