Solved

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

Posted on 2008-10-06
2
1,253 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to shrink a transaction log file down to a reasonable size.

707 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