Sql-Server Seleccionar en Desde consulta

hello i am facing the following challenge:

i am using SQL SERVER and I want to do the following action:

SELECT * INTO existingTable
FROM (SELECT * FROM tbl);

I want to know how is it possible to get query result into a table with a SQL statement

gracias por adelantado.

preguntado el 28 de mayo de 14 a las 14:05

You'll have to explain what the problem is. I don't see a question being asked here. -

as I use the following code i get errors regarding ')' even tho it doesn't seem to be the problem -

2 Respuestas

Eliminar el from and the (brackets)

insert into existingTable 
select * from tbl

It would be good practice to explicitly name your columns

insert into existingTable (colA, colB, ... )
select col1, col2, ... from tbl

contestado el 28 de mayo de 14 a las 14:05

If the fields between the tables are not the same, you will have to type them out:

Insert Into existingTable (field1, field2, field3, ...)
SELECT field1, field2, field3, ... from tbl

contestado el 28 de mayo de 14 a las 14:05

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.