WinUtilis
__
TS SQL Notes
/* Create a count query for all the tables on the db */
SELECT
'select count(*) ''Count'
+''', '''
+TABLE_SCHEMA
+'.'
+TABLE_NAME
+''' [Name] from '
+TABLE_SCHEMA
+'.['
+TABLE_NAME
+'] union'
FROM INFORMATION_SCHEMA.TABLES
ORDER BY TABLE_NAME
-- Always delete the last union on the last row.>
------------------------------------------------------------------------------
/* Create a select 5 rows query for all the tables on the db */
SELECT
'select top 5 '''+TABLE_NAME +''' [Colum Name],* from '
+TABLE_SCHEMA
+'.['
+TABLE_NAME
+']'
FROM INFORMATION_SCHEMA.TABLES
ORDER BY TABLE_NAME
------------------------------------------------------------------------------
|