In SQL Server, how do I generate a CREATE TABLE statement for a given table?

前端 未结 16 2399
离开以前
离开以前 2020-11-22 11:34

I\'ve spent a good amount of time coming up with solution to this problem, so in the spirit of this post, I\'m posting it here, since I think it might be useful to others. <

16条回答
  •  -上瘾入骨i
    2020-11-22 12:01

    I realise that it's been a very long time but thought I'd add anyway. If you just want the table, and not the create table statement you could use

    select into x from db.schema.y where 1=0
    

    to copy the table to a new DB

提交回复
热议问题