Solved

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

Posted on 2008-10-06
2
1,217 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

708 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