[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

Problems inserting records in a SQL Table

I am using the following command to insert records in a table:
insert into grel01.falcon.dbo.job_ext(select * from tsdaft.falcon.dbo.job_ext where id > 140213)

I keep getting the following error:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'select'.
Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near ')'.

The query seems perfectly fine
0
wademi
Asked:
wademi
  • 2
1 Solution
 
chapmandewCommented:
try this instead:

insert into grel01.falcon.dbo.job_ext
select * from tsdaft.falcon.dbo.job_ext where id > 140213
0
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
Couple of minor points..
(1)  Your database name is grel01.falcon, correct?
(2)  It's widely considered proper design to INSERT specifying all columns, and not with the all-columns asterisk (*).  
0
 
wademiAuthor Commented:
You are the best. THANKS
0
 
chapmandewCommented:
jimhorn, I completely agree.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now