Expert: Ivan Maskovic Date: 5/25/2007 Subject: sql - create table
Question hi Ivan,
I'am currently using terradata and sql to access our dataware house, I'am new to both.
I'm currently having issues with the size of some of my result sets and would like to have the database automatically load the results into a table(not a volatile table) so I can then reference these result on other query
I know how to create a table and manually input record but I would like to have my script automatically load the results into the new table.
Can you provide some assistance on how to tell sql to input results directly to another table.
Regards
Sean
Answer Hi Sean,
First I should tell I have no experience with terradata.
But if I understand your issue right, a SELECT INTO Clause would help you, when using MS SQL Server.
Example:
Your result is obtained using this SELECT:
SELECT COL1,COL2
FROM TABLE1
WHERE COL1 > 1234
If you want your result to automatically load into new table (named MyTable2) , you should write:
SELECT COL1,COL2
FROM TABLE1
WHERE COL1 > 1234
INTO MyTable2