Solved

Microsft, SQL 2005, String or binary data would be truncated.

Posted on 2008-10-06
2
1,233 Views
Last Modified: 2012-05-05
Hi, I am creating a temp table based on SP_Columns and inserting the output of SP_Columns 'MyTable' into the temp table. This works fine for all except one of my tables were i get the error
"String or binary data would be truncated."
the error is pointing to Column_Def NVARCHAR (4000)

Even turning the ANSI_WARNINGS OFF i still get the msg

this is my query

SET ANSI_WARNINGS OFF
CREATE TABLE #SpColumns
(            Table_Qualifier SYSNAME,
            Table_Owner SYSNAME,
            Table_Name SYSNAME,
            Column_Name SYSNAME,
            Data_Type SMALLINT,
            Type_Name VARCHAR(13),
            Precision INT,
            length INT,
            Scale SMALLINT,
            Radix SMALLINT,
            Nullable SMALLINT NOT NULL,
            Remarks VARCHAR (254) NULL,
            Column_Def NVARCHAR (4000) NULL,
            SQL_Data_Type SMALLINT,
            SQL_DateTime_Sub SMALLINT,
            Char_Octet_Length INT NULL,
            Ordinal_Position INT,
            Is_Nullable VARCHAR (254),
            SS_Data_Type TINYINT
)

INSERT INTO #SpColumns EXEC Sp_Columns 'MyTableName'

Help?
SET ANSI_WARNINGS ON
0
Comment
Question by:Matt_Jsy
2 Comments
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
ID: 22650017
make both of yoru varchar fields varchar(255)....also, make your nvachar(4000) field a varchar(8000)
0
 

Author Closing Comment

by:Matt_Jsy
ID: 31503412
Hey that worked, many thanks.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

825 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