Sunday, March 25, 2012

Create table

Can I create table doing a copy of another one who already exist?
thank youYou can use
SELECT * INTO NEWTABLE FROM OLDTABLE
"Alberto" <alberto@.nospam.com> wrote in message
news:%23BBFMmMtDHA.2360@.TK2MSFTNGP10.phx.gbl...
> Can I create table doing a copy of another one who already exist?
> thank you
>|||I don't mean insert data. I want create the new table like the old table.
Thank you.
"»ÆÉ½¹âÃ÷¶¥" <leimin@.fujitsu.sh.cn> escribió en el mensaje
news:OK08etMtDHA.3144@.tk2msftngp13.phx.gbl...
> You can use
> SELECT * INTO NEWTABLE FROM OLDTABLE
>
> "Alberto" <alberto@.nospam.com> wrote in message
> news:%23BBFMmMtDHA.2360@.TK2MSFTNGP10.phx.gbl...
> > Can I create table doing a copy of another one who already exist?
> >
> > thank you
> >
> >
>|||1.YOU CAN TRY:
select * into new table from oldtable where 0=1
2.you try open MSSQLSERVER ENTERPRISE MANAGERMENT
select the oletable mouse right key--generate script--save the
script.then you can run the script in Query Analyzer to create new
table.(just change the table name)
"Alberto" <alberto@.nospam.com> wrote in message
news:%23BBFMmMtDHA.2360@.TK2MSFTNGP10.phx.gbl...
> Can I create table doing a copy of another one who already exist?
> thank you
>|||Actually I'm doing it as you say in the point 2 but in others DBMS like
Informix you can do something like "Create newTable like oldTable".
Thank you.
"»ÆÉ½¹âÃ÷¶¥" <leimin@.fujitsu.sh.cn> escribió en el mensaje
news:uJtW9BNtDHA.3536@.tk2msftngp13.phx.gbl...
> 1.YOU CAN TRY:
> select * into new table from oldtable where 0=1
> 2.you try open MSSQLSERVER ENTERPRISE MANAGERMENT
> select the oletable mouse right key--generate script--save the
> script.then you can run the script in Query Analyzer to create new
> table.(just change the table name)
>
> "Alberto" <alberto@.nospam.com> wrote in message
> news:%23BBFMmMtDHA.2360@.TK2MSFTNGP10.phx.gbl...
> > Can I create table doing a copy of another one who already exist?
> >
> > thank you
> >
> >
>|||Closest to that is SELECT INTO. It will not copy over constraint, indexes etc, though.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Alberto" <alberto@.nospam.com> wrote in message news:ea38LFNtDHA.2088@.TK2MSFTNGP09.phx.gbl...
> Actually I'm doing it as you say in the point 2 but in others DBMS like
> Informix you can do something like "Create newTable like oldTable".
> Thank you.
> "»ÆÉ½¹âÃ÷¶¥" <leimin@.fujitsu.sh.cn> escribió en el mensaje
> news:uJtW9BNtDHA.3536@.tk2msftngp13.phx.gbl...
> > 1.YOU CAN TRY:
> > select * into new table from oldtable where 0=1
> >
> > 2.you try open MSSQLSERVER ENTERPRISE MANAGERMENT
> > select the oletable mouse right key--generate script--save the
> > script.then you can run the script in Query Analyzer to create new
> > table.(just change the table name)
> >
> >
> >
> > "Alberto" <alberto@.nospam.com> wrote in message
> > news:%23BBFMmMtDHA.2360@.TK2MSFTNGP10.phx.gbl...
> > > Can I create table doing a copy of another one who already exist?
> > >
> > > thank you
> > >
> > >
> >
> >
>

No comments:

Post a Comment