vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi there Is there a way of creating a table in sybase like in oracle CTAS e.g. Create table MYTABLE tablespace MYSPACE as select * from test.mytable In sybase the only way that I know is bcp out create a table bcp in and then re name... is there a better way?? Many tanks Maria |
| |||
| You can use SELECT INTO although you have to have this option turned on for the database. eg 1> create table mytable 2> (alpha char(1)) 3> go 1> select * into mytable2 2> from mytable 3> go This will copy the data you have too. If you don't want the data add the condition 'where 1=2' and you'll get just the structure. It won't copy any indexes or triggers and the job is not done as a transaction, so it's quicker but you can't roll it back. Regards Tom evoradba@yahoo.ca (Maria) wrote in message news:<351fd9d6.0311201933.4b085f8b@posting.google. com>... > Hi there > > > Is there a way of creating a table in sybase like in oracle CTAS > > e.g. > > Create table MYTABLE tablespace MYSPACE as select * from > test.mytable > > > In sybase the only way that I know is bcp out create a table bcp in > and then re name... is there a better way?? > > > Many tanks > Maria |
| |||
| select * from test.mytable into myspace.mytable ? evoradba@yahoo.ca (Maria) wrote in message news:<351fd9d6.0311201933.4b085f8b@posting.google. com>... > Hi there > > > Is there a way of creating a table in sybase like in oracle CTAS > > e.g. > > Create table MYTABLE tablespace MYSPACE as select * from > test.mytable > > > In sybase the only way that I know is bcp out create a table bcp in > and then re name... is there a better way?? > > > Many tanks > Maria |
| ||||
| hi, select into is a good way of doing it but it is a nonlogged operation which means after you do it, you cannot backup the transaction log.I would rather go with creating the table and insert into <tab1> select * from <tab2>. Regards Jaideep tom.richards@rocketmail.com (Thomas Richards) wrote in message news:<f118866.0311210459.63c97d76@posting.google.c om>... > You can use SELECT INTO although you have to have this option turned > on for the database. > > eg > > 1> create table mytable > 2> (alpha char(1)) > 3> go > 1> select * into mytable2 > 2> from mytable > 3> go > > This will copy the data you have too. If you don't want the data add > the condition 'where 1=2' and you'll get just the structure. > > It won't copy any indexes or triggers and the job is not done as a > transaction, so it's quicker but you can't roll it back. > > Regards > Tom > > > evoradba@yahoo.ca (Maria) wrote in message news:<351fd9d6.0311201933.4b085f8b@posting.google. com>... > > Hi there > > > > > > Is there a way of creating a table in sybase like in oracle CTAS > > > > e.g. > > > > Create table MYTABLE tablespace MYSPACE as select * from > > test.mytable > > > > > > In sybase the only way that I know is bcp out create a table bcp in > > and then re name... is there a better way?? > > > > > > Many tanks > > Maria |
| Thread Tools | |
| Display Modes | |
|
|