473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

A problem with bcp tool

I need to transfer some data from a file .txt to a SQL Server.
I use bcp tool. The problem is about a column named 'FILE', that I've
declared as:
[FILE] VARCHAR(150) NOT NULL

The command I launch is the following:
bcp.exe EC_CUNEO01.PROJECT.ANTRACCIATO in data_file.txt -f
format_file.fmt -e error_file.err -m 10 -t\t -r\n -k -b1000 -U user -P
password -S server

In the format_file I've declared the format of the columns, referring to the
'FILE' one as:
3 SQLCHAR 0 150 "\t" 3 [FILE]

But when I try to import the data, the system returns the error:
SQLState = 37000, NativeError = 156
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near
the keyword 'FILE'.

Does anybody know why?

Thank you.
Jul 20 '05 #1
2 2493

"Federica T" <fedina_chicca@N_O_Spam_libero.it> wrote in message
news:ck**********@atlantis.cu.mi.it...
I need to transfer some data from a file .txt to a SQL Server.
I use bcp tool. The problem is about a column named 'FILE', that I've
declared as:
[FILE] VARCHAR(150) NOT NULL

The command I launch is the following:
bcp.exe EC_CUNEO01.PROJECT.ANTRACCIATO in data_file.txt -f
format_file.fmt -e error_file.err -m 10 -t\t -r\n -k -b1000 -U user -P
password -S server

In the format_file I've declared the format of the columns, referring to
the
'FILE' one as:
3 SQLCHAR 0 150 "\t" 3 [FILE]

But when I try to import the data, the system returns the error:
SQLState = 37000, NativeError = 156
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax
near
the keyword 'FILE'.

Does anybody know why?

Thank you.


I would guess it's because FILE is a reserved keyword in MSSQL. According to
BOL, the correct column name is not required in a format file anyway, so you
could try replacing it with a non-reserved word to see what happens.

Alternatively, try using DTS, which is often a bit 'smarter' about these
things, but you should probably change your column name to a non-reserved
word anyway. I appreciate that you might have no control over that, however.

Simon
Jul 20 '05 #2
I would guess it's because FILE is a reserved keyword in MSSQL. According to BOL, the correct column name is not required in a format file anyway, so you could try replacing it with a non-reserved word to see what happens.

Alternatively, try using DTS, which is often a bit 'smarter' about these
things, but you should probably change your column name to a non-reserved
word anyway. I appreciate that you might have no control over that, however.
Simon

I would maintain the name of the column because my application already runs
on a DB2 preexisting Database, which contains columns with this name; I
would make less change as possible...

Thank you, I will try DTS!
Bye
Fede
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

43
by: nospam | last post by:
I got three (3) files (1) Untitled.aspx (2) Untitled.aspx.1.cs (3) Untitled.aspx.2.cs These three files must be used together to make file #1, Untitled.aspx, page work via J.I.T. when the...
1
by: Vandana Rola | last post by:
Hello Everyone, We are using javascript's tooltip (pop up on mouse over )function. The problem we are having is as we go scroll two or three pages deep in to the html page our tool tip /pop up...
6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
8
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating...
5
by: Edwin Yip | last post by:
Dear all, coding a test classes for classes being tested is really boring, is there any tool can generate 'test cases'?
16
by: jblankenburg | last post by:
I am trying to deploy a simple web application to my client's production server, but it's not clear to me how MS planned on having the Security users managed without Studio. Certainly someone...
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
1
by: anathema | last post by:
Having a bit of trouble adapting some code for my use. This is the desired outcome - a user clicks on a#tools-link. This shows / hides the div #tool-box and a cookie is set to remember it's...
26
by: webrod | last post by:
Hi, I have some php pages with a lot of HTML code. I am looking for a HTML validator tool (like TIDY). TIDY is not good enough with PHP tags (it removes a lot of php code). Do you have any...
5
by: Claudio M. E. Bastos Iorio | last post by:
Hi, anyone using VS2008 (final) on windows Vista? I have a problem. The ASP.NET web site administration tool on any site created by VS2008, running on Vista, is not working as it should. I can...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.