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
 General SQL Server Forums
 New to SQL Server Programming
 syntax

Author  Topic 

kt
Yak Posting Veteran

88 Posts

Posted - 2013-09-17 : 11:26:50
Hi,

i am try to insert the results from the query into new temp table but keep geeting an error for Incorrect syntax near ')'. Would you please tell me what did i have wrong from this query?

Thanks

select * into tempCosting
from
(
select top 10* from itemCode itm
where itm.type= 1
)

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2013-09-17 : 11:32:56
Name the table expression with an alias.

select * into tempCosting
from
(
select top 10* from itemCode itm
where itm.type= 1
) AS x



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

kt
Yak Posting Veteran

88 Posts

Posted - 2013-09-17 : 11:39:05
didn't think about this, thank you.
Go to Top of Page

sigmas
Posting Yak Master

172 Posts

Posted - 2013-09-17 : 11:41:36
just simplify.

select top 10 * into tempCosting
from itemCode
where type= 1;
Go to Top of Page
   

- Advertisement -