what's wrong with this query
CREATE TABLE TABLE2 AS SELECT * FROM TABLE1
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Posted Oct 11, 2010, 2:24 AM EDT
SELECT INTO Table2 FROM Table1;
Posted Oct 11, 2010, 2:25 AM EDT
This link may help you.
David SmithRank #999 · 2K reputationPosted Oct 11, 2010, 6:07 AM EDT
to explain in example what im doing:
im basically running a query for table 1 to populate a status column via the query below, then i grab the calculated status column and select into table2, after I select into table 2, i then call the Select query ( SELECT * into newTable FROM table2) in c# code, after running the query, i go back to the database and the table is empty. the weird thing is it works perfect in the actual database
SELECT middle.datetime, middle.serialnum, Min(middle.pass) AS status
FROM (SELECT [middle].ID, [middle].Maxoftestnames, [middle].datetime, [middle].serialnum, [middle].tag, [middle].count, [middle].threshold, IIf(count<=threshold,'PASS','FAIL') AS pass FROM (SELECT Datatable1.ID, Max(Datatable1.ID) AS ID, Max(Datatable1.TestNames) AS MaxOftestnames, Max(Datatable1.stamp) AS datetime, Max(uutserialnum) AS serialnum, Datatable1.tag, Count(Datatable1.tag) AS count, table_Threshold.Threshold FROM Datatable1 LEFT JOIN table_Threshold ON (Datatable1.tag=table_Threshold.tag) AND (Datatable1.ID=table_Threshold.ID) GROUP BY Datatable1.ID, Datatable1.stamp, Datatable1.tag, table_Threshold.Threshold) AS middle WHERE ((([middle].tag) Like '[123456789ABCD]*'))) AS middle
GROUP BY middle.datetime, middle.serialnum
ORDER BY middle.datetime;