SQL Server query - copy all tables from query into database -
i have question copy tables query other database.
i use query in sql server:
select * information_schema.tables tablename = '2000'
this query returns tables. , copy returned tables other database.
thank in advance.
have @ sp_msforeachtable
, feed table names information_schema.tables
there example here started sp_msforeachtable example
another example can modified here
this amended suit needs:
exec sp_msforeachtable @command1 = "select count(*) [?] ?", @whereand = "and uid = (select schema_id sys.schemas name = 'dbo') , o.name 'iin%'"
replace @command1 copy code (something select * ...
, replace @whereand filter tables or in
statement if have list.
Comments
Post a Comment