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
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
SELECT * INTO NWDEBTP_DROP_V600 FROM nwdebtp
TRUNCATE TABLE nwdebtp
TRUNCATE TABLE nwdebtp
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_V6 00'
sp_rename 'NWDEBTP','NWDEBTP_DROP_V6
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT *
INTO NWDEBTP_DROP_V600
FROM NWDEBTP
TRUNCATE TABLE NWDEBTP