SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


String or binary data would be truncated!!!


String or binary data would be truncated!!!

Author
Message
JMSM
JMSM
Mr or Mrs. 500
Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)

Group: General Forum Members
Points: 500 Visits: 977
Hello,

I've run a profiler into a trace file 'D:\Traces\Troubleshoot-TRACES.trc' but when i insert all data in a table the following error appears.
Note: The code of the table and insert statement appears at bottom of the post.

Msg 8152, Level 16, State 10, Line 1
String or binary data would be truncated.
The statement has been terminated.


The problem as i can see was in the TextData field and i've changed from varchar (4000) to varchar (8000) but the error became the same.
Any idea?
Hope u can help me.

Regards,
JMSM ;-)

create table TraceResults(
TextData VARCHAR(4000),
Duration INT,
Reads INT,
Writes INT,
CPU INT,
StartTime DATETIME,
ProcedureName VARCHAR(100),
LoginName varchar(50),
NTUserName varchar(50))
go

insert into TraceResults (TextData, Duration, Reads, Writes, CPU, StartTime, LoginName, NTUserName)
select TextData, Duration/1000, Reads, Writes, CPU, StartTime, LoginName, NTUserName
from fn_trace_gettable('D:\Traces\Troubleshoot-TRACES.trc',1)
muthukkumaran Kaliyamoorthy
muthukkumaran Kaliyamoorthy
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1989 Visits: 4941
JMSM (3/2/2010)
Hello,

I've run a profiler into a trace file 'D:\Traces\Troubleshoot-TRACES.trc' but when i insert all data in a table the following error appears.
Note: The code of the table and insert statement appears at bottom of the post.

Msg 8152, Level 16, State 10, Line 1
String or binary data would be truncated.
The statement has been terminated.


The problem as i can see was in the TextData field and i've changed from varchar (4000) to varchar (8000) but the error became the same.
Any idea?
Hope u can help me.

Regards,
JMSM ;-)

create table TraceResults(
TextData VARCHAR(4000),
Duration INT,
Reads INT,
Writes INT,
CPU INT,
StartTime DATETIME,
ProcedureName VARCHAR(100),
LoginName varchar(50),
NTUserName varchar(50))
go

insert into TraceResults (TextData, Duration, Reads, Writes, CPU, StartTime, LoginName, NTUserName)
select TextData, Duration/1000, Reads, Writes, CPU, StartTime, LoginName, NTUserName
from fn_trace_gettable('D:\Traces\Troubleshoot-TRACES.trc',1)



Why you create separate table just use select * into :-)

Muthukkumaran Kaliyamoorthy

Helping SQL DBAs and Developers >>>SqlserverBlogForum

Steve Jones
Steve Jones
SSC Guru
SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)SSC Guru (62K reputation)

Group: Administrators
Points: 62174 Visits: 19102
The issue is that you don't have enough space for something. I'd try varchar(max). If that doesn't work, then it's not that field. It might be any of the char fields. You can insert them one by one to debug which one it is.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
muthukkumaran Kaliyamoorthy
muthukkumaran Kaliyamoorthy
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1989 Visits: 4941
Or just run this -- sp_help 'fn_trace_gettable'

Muthukkumaran Kaliyamoorthy

Helping SQL DBAs and Developers >>>SqlserverBlogForum

JMSM
JMSM
Mr or Mrs. 500
Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)Mr or Mrs. 500 (500 reputation)

Group: General Forum Members
Points: 500 Visits: 977
Thanks a lot everybody.
I've used the following statement on insert


SET ANSI_WARNINGS OFF
insert into TraceResults(TextData, Duration, Reads, Writes, CPU, StartTime, LoginName, NTUserName)
select TextData, Duration/1000, Reads, Writes, CPU, StartTime, LoginName, NTUserName
from fn_trace_gettable('D:\Traces\Troubleshoot-TRACES.trc',1)
SET ANSI_WARNINGS ON

Is there any problem to the final result?
Regards,
JMSM ;-)
Lowell
Lowell
One Orange Chip
One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)One Orange Chip (28K reputation)

Group: General Forum Members
Points: 28090 Visits: 39930
i just create a view of a trace,a nd then scripted the view to be a table;

CREATE VIEW sp_DMLTrace
AS
SELECT * FROM ::fn_trace_gettable('c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\MyDMLtrace2.trc', default)




here's it's definition; does it match what you were using?

CREATE TABLE [dbo].[SP_DMLTRACE] (
[TEXTDATA] NTEXT NULL,
[BINARYDATA] IMAGE NULL,
[DATABASEID] INT NULL,
[TRANSACTIONID] BIGINT NULL,
[LINENUMBER] INT NULL,
[NTUSERNAME] NVARCHAR(256) NULL,
[NTDOMAINNAME] NVARCHAR(256) NULL,
[HOSTNAME] NVARCHAR(256) NULL,
[CLIENTPROCESSID] INT NULL,
[APPLICATIONNAME] NVARCHAR(256) NULL,
[LOGINNAME] NVARCHAR(256) NULL,
[SPID] INT NULL,
[DURATION] BIGINT NULL,
[STARTTIME] DATETIME NULL,
[ENDTIME] DATETIME NULL,
[READS] BIGINT NULL,
[WRITES] BIGINT NULL,
[CPU] INT NULL,
[PERMISSIONS] BIGINT NULL,
[SEVERITY] INT NULL,
[EVENTSUBCLASS] INT NULL,
[OBJECTID] INT NULL,
[SUCCESS] INT NULL,
[INDEXID] INT NULL,
[INTEGERDATA] INT NULL,
[SERVERNAME] NVARCHAR(256) NULL,
[EVENTCLASS] INT NULL,
[OBJECTTYPE] INT NULL,
[NESTLEVEL] INT NULL,
[STATE] INT NULL,
[ERROR] INT NULL,
[MODE] INT NULL,
[HANDLE] INT NULL,
[OBJECTNAME] NVARCHAR(256) NULL,
[DATABASENAME] NVARCHAR(256) NULL,
[FILENAME] NVARCHAR(256) NULL,
[OWNERNAME] NVARCHAR(256) NULL,
[ROLENAME] NVARCHAR(256) NULL,
[TARGETUSERNAME] NVARCHAR(256) NULL,
[DBUSERNAME] NVARCHAR(256) NULL,
[LOGINSID] IMAGE NULL,
[TARGETLOGINNAME] NVARCHAR(256) NULL,
[TARGETLOGINSID] IMAGE NULL,
[COLUMNPERMISSIONS] INT NULL,
[LINKEDSERVERNAME] NVARCHAR(256) NULL,
[PROVIDERNAME] NVARCHAR(256) NULL,
[METHODNAME] NVARCHAR(256) NULL,
[ROWCOUNTS] BIGINT NULL,
[REQUESTID] INT NULL,
[XACTSEQUENCE] BIGINT NULL,
[EVENTSEQUENCE] BIGINT NULL,
[BIGINTDATA1] BIGINT NULL,
[BIGINTDATA2] BIGINT NULL,
[GUID] UNIQUEIDENTIFIER NULL,
[INTEGERDATA2] INT NULL,
[OBJECTID2] BIGINT NULL,
[TYPE] INT NULL,
[OWNERID] INT NULL,
[PARENTNAME] NVARCHAR(256) NULL,
[ISSYSTEM] INT NULL,
[OFFSET] INT NULL,
[SOURCEDATABASEID] INT NULL,
[SQLHANDLE] IMAGE NULL,
[SESSIONLOGINNAME] NVARCHAR(256) NULL,
[PLANHANDLE] IMAGE NULL)



Lowell

--
help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search