Also on the subject of checksum testing, this query will generate a checksum query for a given table. Use this query to generate the checksum for each table, then customize the sum() clauses if you did any transformations on your data.


select case a.xtype
when 167 then 'SUM(LEN('+a.name+')) as sum_len_'+a.name+','
when 175 then 'SUM(LEN('+a.name+')) as sum_len_'+a.name+','
when 231 then 'SUM(LEN('+a.name+')) as sum_len_'+a.name+','
when 106 then 'SUM('+a.name+') as sum_'+a.name+','
when 56 then 'SUM('+a.name+') as sum_'+a.name+','
when 104 then 'SUM(CONVERT(int,'+a.name+')) as sum_'+a.name+','
when 61 then 'SUM(MONTH('+a.name+')+DAY('+a.name+')+YEAR('+a.name+')) as sum_'+a.name+',
SUM(LEN(MONTH('+a.name+'))+LEN(DAY('+a.name+'))+LEN(YEAR('+a.name+'))) as sum_len_'+a.name+',' -- datetime
else a.name+' '+convert(varchar,a.xtype)
end col_type
from syscolumns a, sysobjects b
where a.id=b.id and b.xtype='U'
and upper(b.name) = 'MYTABLE'
order by b.name, a.name, a.colid

Tags: , ,

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>