February 7, 2014 at 4:02 am
Hi
how can I archive to SELECT * INTO existing table without listing column names?
February 7, 2014 at 4:12 am
Not quite sure what you're asking
Select * into Table_A from Table_B
February 7, 2014 at 4:13 am
If the target table already exists then you would need to use INSERT INTO
I always prefer to list the column names in my INSERT INTO and SELECT statements, however you don't have to.
Example:
CREATE TABLE SSC_Target (Column1 INT, Column2 INT, Column3 INT)
CREATE TABLE SSC_Source (Column1 INT, Column2 INT, Column3 INT)
INSERT INTO SSC_Source VALUES (1, 2, 3), (4, 5, 6)
INSERT INTO SSC_Target
SELECT * FROM SSC_Source
SELECT * FROM SSC_Target
SELECT * FROM SSC_Source
DROP TABLE SSC_Target
DROP TABLE SSC_Source
---------------------------------------------------------
It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens[/url]
Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
February 7, 2014 at 4:19 am
I had this code
select *
INTO Hosea_tempTable
from Hosea_tblDATA_Product_Reports
I see my error was select, I had to insert.
February 7, 2014 at 4:23 am
hoseam (2/7/2014)
I have this codeselect *
INTO Hosea_tempTable
from Hosea_tblDATA_Product_Reports
and I get this error;
There is already an object named 'Hosea_tempTable' in the database
Yes, that's because SELECT INTO attempts to create a table that already exists in your database. You want to be using INSERT INTO instead.
---------------------------------------------------------
It takes a minimal capacity for rational thought to see that the corporate 'free press' is a structurally irrational and biased, and extremely violent, system of elite propaganda.
David Edwards - Media lens[/url]
Society has varying and conflicting interests; what is called objectivity is the disguise of one of these interests - that of neutrality. But neutrality is a fiction in an unneutral world. There are victims, there are executioners, and there are bystanders... and the 'objectivity' of the bystander calls for inaction while other heads fall.
Howard Zinn
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply