Solved

Problems inserting records in a SQL Table

Posted on 2008-10-20
4
208 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL HELP 2 75
SQl server restarts itself 6 29
Incremental load example 2 43
Pivot Query Problem 9 31
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…
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

706 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now