Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Problems inserting records in a SQL Table

Posted on 2008-10-20
4
Medium Priority
?
263 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 2000 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 66

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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview

782 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