March 29, 2010 at 4:50 am
I am importing a very large data into a table using bcp command.One of the column in the table is a reserved word, I am
getting this error
Starting copy...
SQLState = 37000, NativeError = 156 Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'Plan'
How can I handle the reserve word while importing data into a table?
I have attached an example.
March 29, 2010 at 5:04 am
You might try the '-q' parameter so that quoted identifiers are used.
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
March 29, 2010 at 5:14 am
Hi Bhuvnesh, can you show me for the attached example how to use the
'-q' parameter in bcp for the column names.
March 29, 2010 at 5:27 am
Thanks Bhuvnesh I got it
March 29, 2010 at 3:49 pm
Ashwin M N (3/29/2010)
Thanks Bhuvnesh I got it
Got what? Two way street here... what "got it"? What was the fix?
--Jeff Moden
Change is inevitable... Change for the better is not.
March 29, 2010 at 11:33 pm
I used [] for column names in the format file and in the bcp command prompt I added -q.
bcp AdventureWorks.HumanResources.myTeam in input.dat -U username -S servername -t , -f myTeam.Fmt -q
It is working fine.
But I have another problem in another table The column is of bit datatype not null default(0) how should I handle this.
March 30, 2010 at 1:17 am
Always try to post exact error to get faster response :-).also post BCP query
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
March 30, 2010 at 1:22 am
Ashwin M N (3/29/2010)
But I have another problem in another table The column is of bit datatype not null default(0) how should I handle this.
Instead of using -n (native) datatype (data-format switch), try using -c (character).this might help you.
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
March 30, 2010 at 1:34 am
I tried using -c
bcp AdventureWorks.HumanResources.myTeam in input.dat -U username -S servername -t , -f myTeam.Fmt -c
It gave the message that -f overwrites the -c
March 30, 2010 at 1:53 am
NO idea about that message
This link might help you http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.utility/html/utility/utility73.htm
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply