| Author |
Topic |
|
dbonneau
Yak Posting Veteran
50 Posts |
Posted - 2009-02-25 : 11:53:27
|
| Hi,I would like to get some data from table A and append it into table B which has exactly same fields.I used following logic but gives me an error saying "Incorrect syntax near the keyword into"select * from table Ainto table B where contractname = 'F' and date = '02/19/2009'Thanks |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-02-25 : 11:55:01
|
| It shud be select * into table B from table Awhere contractname = 'F' and date = '02/19/2009' |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-25 : 11:55:15
|
Use :Insert into TablenameSelect query........ |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-02-25 : 11:55:59
|
quote: Originally posted by vijayisonly It shud be select * into table B from table Awhere contractname = 'F' and date = '02/19/2009'
This won't work as table is already created. |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2009-02-25 : 14:12:20
|
| Oh yeah...sorry abt that Sodeep...SELECT INTO cannot be used on an existing table. |
 |
|
|
dbonneau
Yak Posting Veteran
50 Posts |
Posted - 2009-04-15 : 13:51:28
|
quote: Originally posted by sodeep Use :Insert into TablenameSelect query........
Hi, I created a new table and tried to insert data from existing table. But I am getting an error on insert into partmy tableAAA has all fields except [ID], [DIff] and [Flag]Does anyone know how to fix this problem ?Thank you so much !Create Table [dbo].[tablenew] ( [ID] int identity(1,1) not null, [Date] datetime null, [Time] datetime null, [Volume] int null, [Price] float null, [Diff] float null, [Flag] nchar(1) null)insert into tablenew from tableAAA\ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-04-15 : 13:53:56
|
| [code]insert into tablenew ([Date],[Time],[Price])SELECT [Date],[Time],[Price] from tableAAA[/code] |
 |
|
|
dbonneau
Yak Posting Veteran
50 Posts |
Posted - 2009-04-15 : 14:08:01
|
quote: Originally posted by visakh16
insert into tablenew ([Date],[Time],[Price])SELECT [Date],[Time],[Price] from tableAAA
Thank you so much !! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-04-15 : 14:14:13
|
| welcome |
 |
|
|
|