How to copy a table schema and constraints to a table of different database? [closed]
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . What SQL can be used to copy the schema of a specified table to a table in different database? 回答1: SELECT INTO will create a new table with the same schema. So you could: SELECT * INTO newdb.dbo.newtable FROM olddb.dbo.oldtable To just copy the schema and not the data: SELECT TOP 0 * INTO newdb.dbo.newtable