﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / String or binary data would be truncated!!! / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 19 May 2013 18:56:42 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: String or binary data would be truncated!!!</title><link>http://www.sqlservercentral.com/Forums/Topic875191-392-1.aspx</link><description>i just create a view of a trace,a nd then scripted the view to be a table;[code]CREATE VIEW sp_DMLTrace AS SELECT * FROM ::fn_trace_gettable('c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\MyDMLtrace2.trc', default)[/code]here's it's definition; does it match what you were using?[code]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)[/code]</description><pubDate>Tue, 02 Mar 2010 08:53:02 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: String or binary data would be truncated!!!</title><link>http://www.sqlservercentral.com/Forums/Topic875191-392-1.aspx</link><description>Thanks a lot everybody.I've used the following statement on insert[b]SET ANSI_WARNINGS OFF[/b]insert into TraceResults(TextData, Duration, Reads, Writes, CPU, StartTime, LoginName, NTUserName)select TextData, Duration/1000, Reads, Writes, CPU, StartTime, LoginName, NTUserNamefrom fn_trace_gettable('D:\Traces\Troubleshoot-TRACES.trc',1)[b]SET ANSI_WARNINGS ON[/b]Is there any problem to the final result?Regards,JMSM ;-)</description><pubDate>Tue, 02 Mar 2010 08:38:04 GMT</pubDate><dc:creator>JMSM</dc:creator></item><item><title>RE: String or binary data would be truncated!!!</title><link>http://www.sqlservercentral.com/Forums/Topic875191-392-1.aspx</link><description>Or just run this -- sp_help 'fn_trace_gettable'</description><pubDate>Tue, 02 Mar 2010 08:28:24 GMT</pubDate><dc:creator>muthukkumaran Kaliyamoorthy</dc:creator></item><item><title>RE: String or binary data would be truncated!!!</title><link>http://www.sqlservercentral.com/Forums/Topic875191-392-1.aspx</link><description>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.</description><pubDate>Tue, 02 Mar 2010 08:14:21 GMT</pubDate><dc:creator>Steve Jones - SSC Editor</dc:creator></item><item><title>RE: String or binary data would be truncated!!!</title><link>http://www.sqlservercentral.com/Forums/Topic875191-392-1.aspx</link><description>[quote][b]JMSM (3/2/2010)[/b][hr]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.[b]Msg 8152, Level 16, State 10, Line 1String or binary data would be truncated.The statement has been terminated.[/b]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))goinsert into TraceResults (TextData, Duration, Reads, Writes, CPU, StartTime, LoginName, NTUserName)select TextData, Duration/1000, Reads, Writes, CPU, StartTime, LoginName, NTUserNamefrom fn_trace_gettable('D:\Traces\Troubleshoot-TRACES.trc',1)[/quote]Why you create separate table just use [b]select * into [/b]:-)</description><pubDate>Tue, 02 Mar 2010 08:07:06 GMT</pubDate><dc:creator>muthukkumaran Kaliyamoorthy</dc:creator></item><item><title>String or binary data would be truncated!!!</title><link>http://www.sqlservercentral.com/Forums/Topic875191-392-1.aspx</link><description>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.[b]Msg 8152, Level 16, State 10, Line 1String or binary data would be truncated.The statement has been terminated.[/b]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))goinsert into TraceResults (TextData, Duration, Reads, Writes, CPU, StartTime, LoginName, NTUserName)select TextData, Duration/1000, Reads, Writes, CPU, StartTime, LoginName, NTUserNamefrom fn_trace_gettable('D:\Traces\Troubleshoot-TRACES.trc',1)</description><pubDate>Tue, 02 Mar 2010 07:56:19 GMT</pubDate><dc:creator>JMSM</dc:creator></item></channel></rss>