Link to home
Start Free TrialLog in
Avatar of Matt_Jsy
Matt_Jsy

asked on

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

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
ASKER CERTIFIED SOLUTION
Avatar of chapmandew
chapmandew
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Matt_Jsy
Matt_Jsy

ASKER

Hey that worked, many thanks.