... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


MS SQL Server

Here is an MS SQL query that writes an SQL query to show the row counts for all user tables:

select line
from (
  select 0 seq, 'select null table_name, null row_count where 1=2' line
  union select 1, 'union select '''+name+''', count(*) from ['+name+']'
    from dbo.sysobjects where type='U' and name<>'dtproperties'
  union select 2, 'order by 1'
) lines
order by seq, line

Blog Archive