Create table for the results of a SQL statement

Is there a way to create a table for the results of a SQL statement ?

Example: Consider the below query and results.

Select ID,Name,DOB,Gender from EMS.EMS

RESULT 

IDNAMEDOBGender
1Wijnschenk,Greta N.03/09/2009F
2Klausner,Barbara L.03/08/2014M
3Eastman,Liza X.03/11/2000F
4O'Brien,Barb K.03/07/2016M
5Anderson,Nataliya Y.03/14/1991F
6Long,Debby Z.03/12/1999F
7Rogers,Susan W.03/12/1997F
8Ott,Lola J.03/09/2009F
9Yu,Alice S.03/14/1990M
10Wilson,Debby I.03/12/1998M

So, for the above results I want a table named EMS.BASIC which have properties NAME,DOB and Gender with the resulted values.

Thanks in advance.

  • 0
  • 0
  • 272
  • 3
  • 2

Answers

2 steps:

  • create the new table EMS.BASIC
  • INSERT INTO EMS.BASIC (Name,DOB,Gender) Select Name,DOB,Gender from EMS.EMS

Comments

Do you mind sharing what are you trying to accomplish that you need a dynamic table creating mechanism?