I have encountered an error while working with bcp:
SQLState = 22001, NativeError = 0 Error = [Microsoft][SQL Server Native Client 10.0]String data, right truncation
I'm trying to unpack the data into a staging table which does not have any constraints and the datatypes are also fairly large when compared to the data. I have about 11 files from different tables being bcp'd and zipped out of which only one file when unpacking errors out. This is the command which I have been using succesfully. Very recently(when trying to make a copy of the current WH and settign up the process) I have been facing issues.
bcp.exe employee_details in employee_details.dat -n -E -S "servername" -U sa -P "Password"
I have tried changing the commands to -C -T -S which worked when I gave the format manually. This is a very big and important packet I need to load in to my WH.
I don't know if I see a format file here or not.
varchar
-varchar(what)
? What does the input look like? You're giving us a vague error message that indicates you're trying to stuff at least one value that's too big for its column, but you won't tell us the table definitions or show us the data that causes it? How do you expect us to help? Maybe you could print out your file, put it on a dartboard, and throw a dart at it, and it will show you the value that's causing the problem? That's what you're asking us to do for you. – Acrylylbcp
? Can you try Import and Export Data (64-bit) (aka, the DTS wizard)? You must meticulously specify the data format for that just like SSIS and you have to use raw data types instead of SQL data types, but it does work very well and allows you to preview how the data will be interpreted. – Durstin