Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,
I'm try to copy a data from an excel file to SQL database using the bulk copy program in SQL and it gives a error, im using SQL2005 and here is my statement:
"BCP databasename..tablename in school.txt -c -S(servername) -Usa -Ppass"
the error message is:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'.
thanks
Posted
Updated 9-Jul-12 14:25pm
v2
Comments
[no name] 9-Jul-12 19:43pm    
Don't you think that telling us what the error is might be of some value?
sisey shaban 9-Jul-12 20:20pm    
the error message is:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'.

You need to specify the schema: databasename.schema.tablename
http://sqlfool.com/2008/12/bcp-basics/[^]
http://msdn.microsoft.com/en-us/library/aa337544.aspx[^]
 
Share this answer
 
HI ..

Please try this below query.

SQL
BULK
INSERT user_list
FROM 'E:\sharedE\userlist.csv'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900