How to Copy Data one table to another table using sql server 2005 query?
i want to Copy data one table to another table
my table out put like this
EnrollNo CheckIn CheckOut DiffTime
92 NULL NULL NULL
3032 09:40:00 18:31:00 08:51:00
4011 18:30:00 18:38:00 00:0开发者_StackOverflow8:00
4019 18:32:00 18:32:00 00:00:00
438 10:00:00 18:32:00 08:32:00
To insert into an existing table
INSERT INTO Destination
(EnrollNo,
CheckIn,
CheckOut,
DiffTime)
SELECT EnrollNo,
CheckIn,
CheckOut,
DiffTime
FROM Source
Or to create a new table
SELECT EnrollNo,
CheckIn,
CheckOut,
DiffTime
INTO NewTable
FROM Source
Thank you so much. both the option works. create table newtable as select * from source;
Step1: select * from FT_customer; TC_CNO TC_NAMETC_ADDRESS TC_STATE TC_ZIP TC_PHONE TC_REMARKS
1 TRUE WHEEL 55O HUSK ER 58702 555-4545 NONE
2 BIKE SPEC CPT SHRIV EL 45678 555-1234 NONE
3 LE SHOPPE POMETOWN KS 54678 555-1234 NONE
4 AAA BIKE 10 OLDTOWN NE 56784 555-1234 NONE
5 JACKS BIKE 24 EGLIN FL 34567 555-2314 NONE
Step2: create table a as select * from ft_customer; select * from a;
TC_CNO TC_NAMETC_ADDRESS TC_STATE TC_ZIP TC_PHONE TC_REMARKS
1 TRUE WHEEL 55O HUSK ER 58702 555-4545 NONE
2 BIKE SPEC CPT SHRIV EL 45678 555-1234 NONE
3 LE SHOPPE POMETOWN KS 54678 555-1234 NONE
4 AAA BIKE 10 OLDTOWN NE 56784 555-1234 NONE
5 JACKS BIKE 24 EGLIN FL 34567 555-2314 NONE
Priya
abcpune.com
精彩评论