Showing posts with label thisselect. Show all posts
Showing posts with label thisselect. Show all posts

Friday, March 30, 2012

Query 2 databases

Hi all,
Does anyone know how can I select data across 2 databases in SQL ? I want
to do something like this:
Select A.SentDate from dbo.DBA.TblA A, dbo.DBB.TblB B
Where B.FileName = '01012005.txt'
And A.AKey = B.BKey
But it doesn't work and give me an error "Invalid object name dbo.DBA.TblA",
guessing could be syntax error (?)... any idea?
Thanks !!
K.K>It should be
Database.owner.objectname as in
DBA.dbo.TblA
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"K.K." <someone@.microsoft.com> wrote in message
news:%23F$cuW6IFHA.4060@.TK2MSFTNGP14.phx.gbl...
> Hi all,
> Does anyone know how can I select data across 2 databases in SQL ? I want
> to do something like this:
> Select A.SentDate from dbo.DBA.TblA A, dbo.DBB.TblB B
> Where B.FileName = '01012005.txt'
> And A.AKey = B.BKey
> But it doesn't work and give me an error "Invalid object name
> dbo.DBA.TblA", guessing could be syntax error (?)... any idea?
> Thanks !!
> K.K>
>
>

Monday, March 26, 2012

Query

my query looks like this
select a,c,d
from aaa
where some condtion
union all
select a,c,d
from bbbb
where some condtion
how to put the result into temp. table
thanks
kalyan
Hi,
Use the below query format:-
Select * into #temp1 FROM (Select i from X11 Union ALL Select i from X12) K
Thanks
Hari
SQL Server MVP
"Kalyan" <Kalyan@.discussions.microsoft.com> wrote in message
news:42EA9755-D5C3-47F8-97A2-A4C1E6CBB4D1@.microsoft.com...
> my query looks like this
> select a,c,d
> from aaa
> where some condtion
> union all
> select a,c,d
> from bbbb
> where some condtion
> how to put the result into temp. table
>
> thanks
> kalyan
>

Friday, March 23, 2012

Query

my query looks like this
select a,c,d
from aaa
where some condtion
union all
select a,c,d
from bbbb
where some condtion
how to put the result into temp. table
thanks
kalyanHi,
Use the below query format:-
Select * into #temp1 FROM (Select i from X11 Union ALL Select i from X12) K
Thanks
Hari
SQL Server MVP
"Kalyan" <Kalyan@.discussions.microsoft.com> wrote in message
news:42EA9755-D5C3-47F8-97A2-A4C1E6CBB4D1@.microsoft.com...
> my query looks like this
> select a,c,d
> from aaa
> where some condtion
> union all
> select a,c,d
> from bbbb
> where some condtion
> how to put the result into temp. table
>
> thanks
> kalyan
>