|Article Time Stamp: 08 April 2012, 20:18:24 GMT+7|
Microsoft SQL (MS SQL): Syntax Error And Solutions
It seems that at BIRTH's column may contain null values. This caused those following error. You may want to change the BIRTH column type into DateTime then do the import process again.
This problem occurs when you are trying to insert a value (string or binary) that exceeds fields length.
If you have field_a with 4 digit length as varchar type. Then you had insert a value "ADVENTURE". Microsoft SQL engine will display the error message "String or binary data would be truncated".
If you've set ANSI_WARNINGS OFF, Microsoft SQL will truncated the records into ADVE, and then continue on to the next records.
- ANSI_WARNINGS must be ON for queries that involves linked servers, indexed views and indexes on computed columns. Thus setting ANSI_WARNINGS OFF can cause the query to fail to run much slower.
- Putting SET ANSI_WARNINGS OFF in a procedure will trigger a recompilation of the procedure, so it might be better to set it before calling the procedure.