• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

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
0
Richardsoet
Asked:
Richardsoet
1 Solution
 
rafranciscoCommented:
Try this:

SELECT *
INTO NWDEBTP_DROP_V600
FROM NWDEBTP

TRUNCATE TABLE NWDEBTP
0
 
Brian CroweCommented:
SELECT * INTO NWDEBTP_DROP_V600 FROM nwdebtp
TRUNCATE TABLE nwdebtp
0
 
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ispalenyCommented:
NWDEBTP_DROP_V600 is created automatically by SELECT INTO command
0
 
Brian CroweCommented:
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
 
r_a_j_e_s_hCommented:


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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now