I need to be able to select into a temporary table (which is really a copy of the base table, not really 'temporary'). The problem I'm running into is that the base table uses GUIDs for the Primary Key, and upon attempting to run a:
SELECT * INTO HOLD_TABLE FROM ORIGINAL_TABLE WHERE CRITERIA IS NULL;
I keep getting a Syntax Error Near '(' on Line 1)
The only thing I can come up with is because the table has a GUID for the Primary Key.
Has anybody ran into this before, or have any tips on circumventing the issue?
Thanks,
Calvin
EDIT:
Table Structure:
CREATE TABLE "DBA"."Consumer_Plan_Section_Services" (
"CP_Assessment_Service_ID" uniqueidentifier NOT NULL,
"Consumer_Plan_ID" uniqueidentifier NOT NULL,
"Template_Section_ID" uniqueidentifier NOT NULL,
"Service_Needed" long varchar NULL,
"Service_ID" double NULL,
"Service_Type_ID" double NULL,
"Frequency" integer NULL,
"Duration" char(1) NULL,
"Vendor_ID" double NULL,
"Type_of_Provider" varchar(10) NULL,
"Type_ID" double NULL,
"User_Id" varchar(30) NULL,
"Last_Update" timestamp NULL,
"Remote_Location" integer NULL,
"Funding_Source_ID" double NULL,
"Effective_Start_Date" date NULL,
"Effective_End_Date" date NULL,
"Staff_Training_Required" char(1) NULL DEFAULT 'N',
"Service_Levels" varchar(256) NULL,
"Order_Number" integer NOT NULL DEFAULT 0,
"Freq_Duration_Desc" varchar(100) NULL,
PRIMARY KEY ( "CP_Assessment_Service_ID" ASC )
);
Select Statement:
SELECT * INTO Invalid_CP_Section_Services FROM Consumer_Plan_Section_Services WHERE Vendor_ID IS NULL;
asked
21 Jun '10, 17:26
Calvin Allen
1.5k●23●26●38
accept rate:
25%
This sounds like a bug. What exact version and build number are you using?
10.0.1.4036....
I can also give more exact table definitions if anybody wants to see them.
Yes, please show us your table definitions. I've tried to repro the issue and was not able to.
Added..........
Works in V11 with or without the # prefix, but it looks like the # prefix is necessary in V10 if you have any uniqueidentifier columns: SELECT * INTO #Invalid_CP_Section_Services FROM Consumer_Plan_Section_Services WHERE Vendor_ID IS NULL;