CREATE TABLE STUDENTS AS SELECT STUD_ID, STUD_NAME FROM STUDENT;
This syntax would create me a table instantly, which I would be able to refer elsewhere. The same feature is available in Microsoft SQL Server as well, just that the syntax is different.
Resolution: The SQL server equivalent of the above query would be as below,
SELECT A.* INTO STUDENTS FROM( SELECT STUD_ID, STUD_NAME FROM STUDENT) Asyntax:
SELECT A.* INTO Insert_Table_Name FROM
(
Your query here.
) A
Note that you need not create the table upfront before running this script. The query creates the table and it's structure based on the result set.
We hope this came of help to you. For more such posts relating Oracle and Microsoft SQL Server check the label - Oracle to SQL Server .
No comments:
Post a Comment