Link to home
Start Free TrialLog in
Avatar of Richardsoet
Richardsoet

asked on

sql tABLE

Could you please rewrite the oracle script below in sql script

i want to remane the nwdebtp table as NWDEBTP_DROP_V600 and then select all data in nwdebtp  into NWDEBTP_DROP_V600 table and truncate the nwdebtp. the nwdebtp is already exist in the sql  2000 database

CREATE TABLE NWDEBTP_DROP_V600 AS SELECT * FROM NWDEBTP

TRUNCATE TABLE NWDEBTP
Avatar of rafrancisco
rafrancisco

Try this:

SELECT *
INTO NWDEBTP_DROP_V600
FROM NWDEBTP

TRUNCATE TABLE NWDEBTP
Avatar of Brian Crowe
SELECT * INTO NWDEBTP_DROP_V600 FROM nwdebtp
TRUNCATE TABLE nwdebtp
Avatar of Richardsoet

ASKER

BUT I STILL NEED TO CREATE TABLE  NWDEBTP_DROP_V600 AS NWDEBTP TABLE THAT EXIST IN THE DATABASE HOW DO I DO THAT
NWDEBTP_DROP_V600 is created automatically by SELECT INTO command
SELECT INTO copies the data and the schema.  I'm not sure about any indexes or constraints...could someone confirm or deny this?
Just data, no indexes or constraints. The only one special copied information is identity column.
If you just need to change the name of the table, use sp_rename system procedure:

sp_rename 'NWDEBTP','NWDEBTP_DROP_V600'
ASKER CERTIFIED SOLUTION
Avatar of r_a_j_e_s_h
r_a_j_e_s_h

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial