-1

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.

Dale K
  • 25,246
  • 15
  • 42
  • 71
  • 1
    Does this answer your question? [How to create a table from select query result in SQL Server 2008](https://stackoverflow.com/questions/16683758/how-to-create-a-table-from-select-query-result-in-sql-server-2008) – Dale K May 03 '21 at 20:01

2 Answers2

1

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 . . .
    . . .;
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
0

Yes you can create a table using the result of a query very easily using into

select <columns> into NewTableName from <query>
Stu
  • 30,392
  • 6
  • 14
  • 33