Skip to content
Advertisement

Create a table on the SQL server with the data from an SQL query?

Is it possible to create a table on the SQL Server with the data from an SQL query?

I am trying to make a data filter screen in an SQL database and I want to try to filter a result that has already been filtered before

If you help me with an example I appreciate.

Advertisement

Answer

In SQL Server you use select into. You can phrase this as:

select . . .
into <tablename>
. . . rest of query here;

Most other databases use create table as:

create table <tablename< as
    select . . .
    . . .;
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement