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)
 Creating a temp table (#TABLE)

Author  Topic 

macsterling
Yak Posting Veteran

56 Posts

Posted - 2008-11-24 : 13:22:14
select baseid,
basecode
proglidn
into #temp
from
(
select baseid,
basecode
proglidn
from glbasecodes g
join xfer_Progl p on substring(p.proglrmb,1,4) = g.basecode
)

I am getting 'Incorrect syntax near ')'.' on the last line

any suggestions?

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-11-24 : 13:33:36
select g. baseid,
g.basecode
p.proglidn
into #temp
from glbasecodes g
join xfer_Progl p
on substring(p.proglrmb,1,4) = g.basecode
Go to Top of Page

macsterling
Yak Posting Veteran

56 Posts

Posted - 2008-11-24 : 13:43:03
Thanks - I had coped the format from another SQL and this is much simpler.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-11-25 : 01:09:30
quote:
Originally posted by macsterling

select baseid,
basecode
proglidn
into #temp
from
(
select baseid,
basecode
proglidn
from glbasecodes g
join xfer_Progl p on substring(p.proglrmb,1,4) = g.basecode
)

I am getting 'Incorrect syntax near ')'.' on the last line

any suggestions?



You need a derived table

select baseid,
basecode
proglidn
into #temp
from
(
select baseid,
basecode
proglidn
from glbasecodes g
join xfer_Progl p on substring(p.proglrmb,1,4) = g.basecode
) as t


Madhivanan

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

- Advertisement -