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
RichardsoetAsked:
Who is Participating?
 
r_a_j_e_s_hConnect With a Mentor Commented:


Hi Richards,
    Just take the SQL script of nwdebtp and edit that SQL Script by changing the table name nwdebtp  as NWDEBTP_DROP_V600.

then run the script, it wil create the table NWDEBTP_DROP_V600.

Then u can transfer the datas from nwdebtp  to NWDEBTP_DROP_V600. and u can truncate the data


0
 
rafranciscoCommented:
Try this:

SELECT *
INTO NWDEBTP_DROP_V600
FROM NWDEBTP

TRUNCATE TABLE NWDEBTP
0
 
Brian CroweDatabase AdministratorCommented:
SELECT * INTO NWDEBTP_DROP_V600 FROM nwdebtp
TRUNCATE TABLE nwdebtp
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

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

sp_rename 'NWDEBTP','NWDEBTP_DROP_V600'
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.