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

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Find the row with the most data

By Luis Chiriff,


Hi All,

I created this script in a hurry so if you have alterations that will make it more efficient they are welcome. The problem was I had a developer ask me how do i find a row with the most data as an update statement was stopping because it had exceeded the 8060 size. So I quickly put this together, hacking some portions from another script I wrote to output data into insert statements.

Copy the script into a query analyser window. Use the 'select name from sysobjects ....' (in the configuration section) to get the table name. Then run the 'sp_help' on the table to work out a id field that you can then goto to fix the data.

Run the script and it will proceed an output of commands you can copy to another window to run. You should see an output like the following

This hasn't been fully tested with all data types but it was promising as it fixed the issue, i've run this under SQL 2000.



Luis Chiriff


Total article views: 804 | Views in the last 30 days: 1
Related Articles

Using the Script Component With Multiple Outputs

This article demonstrates the use of the SSIS Script Component to create multiple outputs from uncon...


Stored Procedure (or) SQL Script Output to Text File

Stored Procedure (or) SQL Script Output to Text File


Exec SQL task and output to XML

task & script run fine, output is junk


Integration Service Script Component

The script component output datatypes don't allow nulls


output behavior

delete output into identity column