Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncating Data Fields to insert into table

Status
Not open for further replies.

Schaeffrcc

Technical User
May 29, 2003
19
US
I am trying to Automate the moving of data from on Database to another with differnt size Fields. I am fine with the data being truncated down from 50 to 30 Char but do not know how to do it.

I get the following error:

Server: Msg 8152, Level 16, State 9, Line 60
String or binary data would be truncated.
The statement has been terminated.

My Query is as follows:

INSERT INTO clients

SELECT case_table.client_seq,
client.client_first_name,
client.client_middle_name,
client.client_last_name,
client_address.client_addr_1,
client_address.client_addr_2,
client_address.client_city,
client_address.client_state,
client_address.client_zip,
client.client_ssn,
client.client_number,
client_phone.client_phone_no,
client.client_dob

FROM (((#CaseHistSeq LEFT JOIN case_table ON
#CaseHistSeq.case_seq = case_table.case_seq) LEFT JOIN client ON
case_table.client_seq = client.client_seq) LEFT JOIN client_address ON
client.client_seq = client_address.client_seq) LEFT JOIN client_phone ON
client_address.client_addr_seq = client_phone.client_phone_seq

WHERE (((client_address.client_addr_primary)="Y"))
ORDER BY case_table.client_seq;

Field such as Client_First_Name is 50 in original Table and 30 in destination table.

I have looked at BOL and only find a Function to Truncate Tables not individual Fields.

Thanks for any help,

Thomas.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top