INSERT INTO OPENROWSET

  • I am running the following

    INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0',

    'Excel 8.0;Database=C:\cm_mssql_2005_profiling\Reports\Template.xls;',

    'SELECT TSQLString, Duration,Reads,Writes,CPU,RowCounts,StartTime,EndTime,ServerName

    FROM [Top_10_by_Reads$]')

    select top 10 TSQLString, duration/1000 as Duration, reads, writes, cpu, rowcounts, starttime, endtime,servername

    from cm_mssql_2005_TRC

    where textdata is not null

    order by Reads desc

    GO

    and relieving the following error

    Msg 8152, Level 16, State 10, Line 1

    String or binary data would be truncated.

    The statement has been terminated.

    The offending column is TSQLString - VARCHAR(max)

    The data does fit, I can cut & paste it.

    ( I'm using SQL 2005, SSIS & export wizards are not options available to me)

    Thanks in Advance

    Ian

  • Well it is not the most elegant solution I have ever come up with but it is working.

    As I said I can cut and paste the data to the cell in excel, and that is what I have done.

    By placing a record into row 2, setting the row properties to hidden and placing it above the frozen pane my report readers can not see the record

    and the above TSQL works providing me with the body of my report.

    If you know how this should be done, please share it with me.

    Thanks

    Ian

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply