Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Help with Simple copy Query

Author  Topic 

luismgh
Starting Member

5 Posts

Posted - 2011-04-07 : 07:13:05
Hi!

I'me a newby at SQL language and i'm trying to copy the contents of one table to another.
The destination table already exists and have the same structure of the source table.
The script is:

INSERT INTO CLH_DESDUPLICACAOLOG_HISTORICO
(Id, Query, Tabela, Ficheiro, EntidadeAgregada, EntidadeSobrevivente, MoradaAgregada, MoradaSobrevivente, Tipo, DataFicheiro)
SELECT (Id, Query, Tabela, Ficheiro, EntidadeAgregada, EntidadeSobrevivente, MoradaAgregada, MoradaSobrevivente, Tipo, DataFicheiro)
FROM CLH_DESDUPLICACAOLOG

And the error returned by SQL is:

Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near ','.

Can anyone help me with this issue?

Thank you in advance!

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-04-07 : 07:16:41
Take away the parentheses in the SELECT part.
quote:
Originally posted by luismgh

Hi!

I'me a newby at SQL language and i'm trying to copy the contents of one table to another.
The destination table already exists and have the same structure of the source table.
The script is:

INSERT INTO CLH_DESDUPLICACAOLOG_HISTORICO
(Id, Query, Tabela, Ficheiro, EntidadeAgregada, EntidadeSobrevivente, MoradaAgregada, MoradaSobrevivente, Tipo, DataFicheiro)
SELECT (Id, Query, Tabela, Ficheiro, EntidadeAgregada, EntidadeSobrevivente, MoradaAgregada, MoradaSobrevivente, Tipo, DataFicheiro)
FROM CLH_DESDUPLICACAOLOG

And the error returned by SQL is:

Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near ','.

Can anyone help me with this issue?

Thank you in advance!





No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

luismgh
Starting Member

5 Posts

Posted - 2011-04-07 : 07:30:28
quote:
Originally posted by webfred

Take away the parentheses in the SELECT part.
quote:
Originally posted by luismgh

Hi!

I'me a newby at SQL language and i'm trying to copy the contents of one table to another.
The destination table already exists and have the same structure of the source table.
The script is:

INSERT INTO CLH_DESDUPLICACAOLOG_HISTORICO
(Id, Query, Tabela, Ficheiro, EntidadeAgregada, EntidadeSobrevivente, MoradaAgregada, MoradaSobrevivente, Tipo, DataFicheiro)
SELECT (Id, Query, Tabela, Ficheiro, EntidadeAgregada, EntidadeSobrevivente, MoradaAgregada, MoradaSobrevivente, Tipo, DataFicheiro)
FROM CLH_DESDUPLICACAOLOG

And the error returned by SQL is:

Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near ','.

Can anyone help me with this issue?

Thank you in advance!





No, you're never too old to Yak'n'Roll if you're too young to die.



Thanks, It worked!

Regards,
Go to Top of Page
   

- Advertisement -