Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Insert Error

Author  Topic 

muzzettemm
Posting Yak Master

212 Posts

Posted - 2009-08-25 : 23:46:37
Anyone See anything wrong with my Insert Statement I keep getting an error message
Msg 8152, Level 16, State 10, Line 1
String or binary data would be truncated.
The statement has been terminated.




INSERT INTO Student_ind
(ParentID, [Family ID], [Student First Name], [Student Last Name], [Student SS#], Phone, Message, StudentAddress, StudentCity, StudentState,
StudentZip, EmailAddress, TribalAfflilation, [Event ID], TanfStaffMakeReferal, TypeOfParticipant, RequiredHours, SpecialInstructions, [Referral Date])
SELECT [Parent ID], [Family ID], [Parent First Name], [Parent Last Name], [Parent SS#], [Telephone #], [Message #], Address, City, State, Zip, [E Mail Address],
[Tribal Affiliation], [Event ID], [TANF staff making Referral], [Type Participant], [Required hours], [Special Instrution], [Date Of Referral]
FROM Parent_ind
WHERE (NOT EXISTS
(SELECT Parent_ind.[Parent ID], [Family ID], Parent_ind.[Parent First Name], Parent_ind.[Parent Last Name], Parent_ind.[Parent SS#],
Parent_ind.[Telephone #], Parent_ind.[Message #], Parent_ind.Address, Parent_ind.City, Parent_ind.State, Parent_ind.Zip,
Parent_ind.[E Mail Address], Parent_ind.[Tribal Affiliation], [Event ID], Parent_ind.[TANF staff making Referral],
Parent_ind.[Type Participant], Parent_ind.[Required hours], Parent_ind.[Special Instrution], Parent_ind.[Date Of Referral]
FROM Student_ind AS Student_ind_1
WHERE ([Family ID] = Parent_ind.[Family ID])))

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-08-26 : 00:25:47
Hi,
u have any bit datatype fields in table, Please go through it once
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2009-08-26 : 00:28:50
Column length of any of string containing column is less in taraget (table in your insert into clause) then in source (table in your select clause). Like in student_ind table, column [student last name] varchar(100) but in parent_ind, column [parent last name] is varchar(150).

Check your all columns length.

Go to Top of Page

muzzettemm
Posting Yak Master

212 Posts

Posted - 2009-08-26 : 03:07:31
ok thank you
Go to Top of Page

muzzettemm
Posting Yak Master

212 Posts

Posted - 2009-08-26 : 03:39:34
Well I took care of that but now it says that "Cannot insert the value null into column IndianEducation.dbo.[Student ID]; column does not allow nulls Insert Fails
Go to Top of Page
   

- Advertisement -