Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Copy Table structure and data

 
   Database Help (Home) -> Sybase RSS
Next:  sys.dm_os_wait_stats results help - performance p..  
Author Message
gopi.anoop

External


Since: Sep 30, 2008
Posts: 1



(Msg. 1) Posted: Tue Sep 30, 2008 4:51 am
Post subject: Copy Table structure and data
Archived from groups: comp>databases>sybase (more info?)

Hi,
I have one table named "table2".
I wanted to create one new table "table1" having the exact data
structure of "table1".
In Oracle we can do like,
create table table1 as
select *
from table2;

Pls tell the query for SYBASE

Regards,

 >> Stay informed about: Copy Table structure and data 
Back to top
Login to vote
Carl Kayser

External


Since: Jan 01, 2007
Posts: 11



(Msg. 2) Posted: Tue Sep 30, 2008 8:44 am
Post subject: Re: Copy Table structure and data [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

wrote in message

> Hi,
> I have one table named "table2".
> I wanted to create one new table "table1" having the exact data
> structure of "table1".
> In Oracle we can do like,
> create table table1 as
> select *
> from table2;
>
> Pls tell the query for SYBASE
>
> Regards,

Offhand, you have to set the database (rough equivalent to Oracle schema)
option to allow the "select into" option. Then you can

select * into new_table from old_table

And then you should do a backup since this is a minimally logged operation.
(And turn off the option if it is unneeded.) A problem is that new_table
will NOT inherit any check or rule constraints nor any indexes. The column
definitions will not be for a usertype (if old_table used any) but for a
base type.

 >> Stay informed about: Copy Table structure and data 
Back to top
Login to vote
gubba.venkatesh

External


Since: Oct 28, 2008
Posts: 1



(Msg. 3) Posted: Tue Oct 28, 2008 9:38 am
Post subject: Re: Copy Table structure and data [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

When I tried to run the query "select * into new_table from old_table"
i received error message.

Then I ahve created a new table with description, then i ran the query
"Insert into new_table select * from old_table.



Carl Kayser wrote:
> wrote in message
>
> > Hi,
> > I have one table named "table2".
> > I wanted to create one new table "table1" having the exact data
> > structure of "table1".
> > In Oracle we can do like,
> > create table table1 as
> > select *
> > from table2;
> >
> > Pls tell the query for SYBASE
> >
> > Regards,
>
> Offhand, you have to set the database (rough equivalent to Oracle schema)
> option to allow the "select into" option. Then you can
>
> select * into new_table from old_table
>
> And then you should do a backup since this is a minimally logged operation.
> (And turn off the option if it is unneeded.) A problem is that new_table
> will NOT inherit any check or rule constraints nor any indexes. The column
> definitions will not be for a usertype (if old_table used any) but for a
> base type.
 >> Stay informed about: Copy Table structure and data 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Will Sybase ever introduce table data types? - Oracle and SQL Server both have them. Data types that are tables that can be passed into a stored procedure via parameters or returned. Most people might think of it as convenient composite type that allows the communicating more complex data betwee...

Create index was aborted because pages in the data only lo.. - Hello Guys, I am getting the following error on Sybase Adaptive Server 15 Error 1581 "Create index was aborted because pages in the data only locked table are not linked" By the way... - the table is an ALL PAGES SCHEME! I firstly create a t...

Text column copy across tables - Hi I have two tables with text columns. I wish to update text column in existing rows in TABLE1 using data present in the text column of a corresponding row in TABLE2. (The row in TABLE2 can be selected without referring to the text column values) ..

Semistructured data in Sybase - Does (any version of) Sybase support the semistructured data model? Can XML documents be stored efficiently on a Sybase database server? What functionality (eg. indexing) and constraints (eg. schema enforcement) does Sybase offer to semistructured data...

Get last dumped/applied log filenames from data or backup .. - Hi, Can I get the following by querying the sybase data or (more likely) backup server: 1. An online database's last dumped transaction log file name and timestamp 2. A standby database's last applied transaction log file name and timestamp. I know the....
   Database Help (Home) -> Sybase All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]