how to fix error with this vague msg?

Posted on 2011-05-11
Last Modified: 2012-06-21
How can I find out which column to fix?  Thank you.

(58 row(s) affected)
Msg 8152, Level 16, State 4, Line 12
String or binary data would be truncated.
The statement has been terminated.

if exists (
    select  * from tempdb.dbo.sysobjects o
    where o.xtype in ('U') 
   and = object_id(N'tempdb..#tempNonExistDoctors')
	DROP TABLE #tempNonExistDoctors;

select * into #tempNonExistDoctors from dbo.Doctors
where personID is null;

INSERT INTO [MedDb].[dbo].[person]
Select lastname, First_Name, MiddleName,credentials,bio,best_doctor, links, appt_emails from #tempNonExistDoctors

DROP TABLE #tempNonExistDoctors;

Open in new window

Question by:lapucca
    LVL 51

    Accepted Solution

    That means one or more of the values you're inserting are too long for the target column.  For example if [person].LastName was a varchar(50) and #tempNonExistDoctors.Lastname was a varchar(100)

    The only way to figure out which are the problem columns is to compare the table definitions of [MedDb].[dbo].[person]  and #tempNonExistDoctors (and or the source information) to find out which columns are causing the problem.


    Author Closing Comment

    Understand, thank you

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
    In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now