Re: Createa table like a existing table?
- From: Steve Jorgensen <nospam@xxxxxxxxxxxxx>
- Date: Tue, 27 Dec 2005 00:32:12 -0800
On Tue, 27 Dec 2005 08:13:25 +0000 (UTC), Erland Sommarskog
<esquel@xxxxxxxxxxxxx> wrote:
>SSG (ssg14j@xxxxxxxxx) writes:
>> I am new to SLQ server. Can anyone tell me how to create a table that
>> should look like a existing table fields....
>
>You can do "SELECT * INTO newtbl FROM tbl WHERE 1 = 0". Beware though
>that constraints, indexes and triggers are not copied. If you want that
>you are better off scripting the table, which you can do by right-clicking
>the table in the Object Broswer in Query Analyzer. Even better, have all
>your source code under version control. Then copying is even easier.
Also note that in most cases where you would want to copy a table's design
within the same database, you'd probably be better off doing more
normalization instead.
.
- References:
- Createa table like a existing table?
- From: SSG
- Re: Createa table like a existing table?
- From: Erland Sommarskog
- Createa table like a existing table?
- Prev by Date: Re: Createa table like a existing table?
- Next by Date: Visual Query Builder with unions and sub-queries
- Previous by thread: Re: Createa table like a existing table?
- Next by thread: Visual Query Builder with unions and sub-queries
- Index(es):