Solved

What is wrong with the following insert statement in SQL Server 2008?

Posted on 2016-09-21
4
34 Views
Last Modified: 2016-09-21
What is wrong with the following insert statement in SQL Server 2008?

tbl_CSL_ImportSV
---------------------------
field1  int
field2  varchar(5)
field3  varchar(11)
filed4  varchar(3)
filed5  varchar(6)
filed6  varchar(8)
field7  datetime
field8  numeric(19,2);
field9  varchar(13)
filed10  varchar(6)
filed11  varchar(6)

Insert into dbo.tbl_CSL_ImportSV
(985,'923','006928','233','054182','000','8/19/2016 0:00:00',1200000.00,'08/31/16','S','A38JMJ');

Msg 102, Level 15, State 1, Line 2
Incorrect syntax near ';'.
0
Comment
Question by:zimmer9
  • 2
4 Comments
 
LVL 10

Expert Comment

by:HuaMinChen
ID: 41809935
Try
Use your_schema
go

Insert into dbo.tbl_CSL_ImportSV
(985,'923','006928','233','054182','000','8/19/2016 0:00:00',1200000.00,'08/31/16','S','A38JMJ')

Open in new window

0
 
LVL 35

Accepted Solution

by:
Terry Woods earned 500 total points
ID: 41809936
I believe you're missing the word "values".

Try:
Insert into dbo.tbl_CSL_ImportSV 
values (985,'923','006928','233','054182','000','8/19/2016 0:00:00',1200000.00,'08/31/16','S','A38JMJ');

Open in new window

0
 

Author Comment

by:zimmer9
ID: 41809938
Terry you are ABSOLUTELY CORRECT. Thanks a million. You ROCK!!! You got me out of the woods.
0
 
LVL 10

Expert Comment

by:HuaMinChen
ID: 41809941
Try
Use your_schema
go

Insert into dbo.tbl_CSL_ImportSV
values (985,'923','006928','233','054182','000','8/19/2016 0:00:00',1200000.00,'08/31/16','S','A38JMJ')

Open in new window

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Server: SNAPSHOT replication to include a newly added table. 2 30
Loop through SQL parameters and insert to temp table? 4 46
SQL trigger 5 23
Negative isnull? 3 16
After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

830 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