Hi @Peter_1985
You could use this query to copy the table schema and data:
Select * into DestinationDB.dbo.tableName from SourceDB.dbo.SourceTable
The SELECT INTO statement creates a new table from the result set of a query. The columns of the new table inherit their names, data types, nullability, and IDENTITY property from the query’s result set.SELECT INTO doesn’t copy constraints, indexes, or triggers from the query’s source.
If you don't want the data,then add a where 1=2
clause:
Select * into DestinationDB.dbo.tableName from SourceDB.dbo.SourceTable Where 1=2
For more methods about Copy table, please refer to this article: Copy Table Schema and Data From One Database to Another Database in SQL Server
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.