Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Bulk Insert - Incorrect Syntax

Author  Topic 

vbbbmom
Starting Member

4 Posts

Posted - 2013-09-23 : 15:14:15
I am very new to SQL. I just upsized my access backend and a few of my tables did not import data. I am trying to do a bulk insert and this is the code I am using:

"BULK INSERT [dbo].[invoices]"
Select ('VendorName, Invoice_Number, DueDate,Type_of_Invoice, Select_field, Invoice_Status, tday, discount, file_as, Invoice_amount, Date_Paid, check_number, apply_discount, amountpaid')
FROM 'A:\Invoices2.csv'
;WITH
(
FIELDTERMINATOR = ',')',
ROWTERMINATOR = "n")',
GO



When I click on the execute button I get this message:

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'A:\Invoices2.csv'.

any help would be appreciated.

vbbbmom

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-09-23 : 15:19:42
You have a misplaced semi-colon before "WITH", and you shouldn't have double quotes around the first line. The select line is also not correct.

Here's the documentation for BULK INSERT, which includes examples.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

vbbbmom
Starting Member

4 Posts

Posted - 2013-09-23 : 15:54:32
Thank you Tara for the response, although I do not see the documentation?

quote:
Originally posted by tkizer

You have a misplaced semi-colon before "WITH", and you shouldn't have double quotes around the first line. The select line is also not correct.

Here's the documentation for BULK INSERT, which includes examples.

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2013-09-23 : 15:56:44
Oops! Here's the link: http://technet.microsoft.com/en-us/library/ms188365.aspx

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
   

- Advertisement -