Feeds:
Posts
Comments

Posts Tagged ‘generate select script for all tbales’

Generate SELECT script
for all tables in a database

 

USE DBName

GO

 

 Get all information about tables in
database

 

SELECT * FROM sys.tables

 

Get only names of tables
in entire database

 

SELECT NAME FROM sys.tables

 

 Now use above to generate select
script for all tables

 

SELECT ‘SELECT *
FROM’
+‘ ‘+‘[‘+NAME +‘]’+‘ ‘+‘GO’ FROM sys.tables

 

 

 

Advertisements

Read Full Post »

%d bloggers like this: