Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --USE YOUR_DATABASE
- --GO
- -- Table and View Names
- SELECT name AS TVNames FROM sysobjects
- WHERE (TYPE = OR TYPE = )
- AND ( name NOT LIKE AND name NOT LIKE )
- ORDER BY name
- -- Table Names
- SELECT name AS TNames FROM sysobjects
- WHERE TYPE = AND name NOT LIKE AND name NOT LIKE
- ORDER BY name
- -- View Names
- SELECT name AS VNames FROM sysobjects
- WHERE TYPE = AND name NOT LIKE AND name NOT LIKE
- ORDER BY name
- -- Tables Count
- SELECT COUNT( name) AS TABLE_COUNT FROM sysobjects
- WHERE TYPE = AND name NOT LIKE AND name NOT LIKE
- -- Views Count
- SELECT COUNT( name) AS VIEW_COUNT FROM sysobjects
- WHERE TYPE = AND name NOT LIKE AND name NOT LIKE
- GO
- -- Creates the table to hold the number of records per table in
- IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID() AND TYPE IN ())
- DROP TABLE [TABLE_RECORDS]
- ELSE
- DELETE FROM [TABLE_RECORDS]
- GO
- CREATE TABLE dbo. TABLE_RECORDS
- (
- TName nvarchar( 300) NULL,
- RecordsCount INT NULL
- ) ON [PRIMARY]
- GO
- --Prints out the insert statements, use print to text feature
- SELECT ( + name + + name + ) AS Name FROM sysobjects
- WHERE TYPE = AND name NOT LIKE AND name <>
- ORDER BY name
- --Prints out the select count staments
- SELECT ( + name + + name) AS Name FROM sysobjects
Advertisement
Add Comment
Please, Sign In to add comment