Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Problems inserting records in a SQL Table

Posted on 2008-10-20
4
234 Views
Last Modified: 2012-05-05
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
Comment
Question by:wademi
  • 2
4 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 22761149
try this instead:

insert into grel01.falcon.dbo.job_ext
select * from tsdaft.falcon.dbo.job_ext where id > 140213
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 22761240
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
 

Author Closing Comment

by:wademi
ID: 31507960
You are the best. THANKS
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 22761371
jimhorn, I completely agree.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question