我有兩個接近相同的表,唯一的區別是較新的有不同的字段名稱。基本上,舊桌子已經過時了,需要重新工作;我試圖提取所有字段,其中VendorNumber = Vendor_ID所有被複制到的字段保證爲空。SQL從舊錶中插入新表
下面的SQL代碼,如果非常大,但它是我可以用它最好的...
SQL = "INSERT INTO tbleVendorData (EDIContact,EDIPhone,EDIEmail,EDIPlatform,EDIStatus,EDIMigrationStatus,EDIMigrationDate,TesterName,TestStartDate,LastContactDate," & _
"CompletionStatus850,CompletionStatus856,CompletionStatus810C,CompletionStatus810F,CompletionStatusMH10,CompletionStatusPTicket,TestingNotes," & _
"TestingStatus850,TestingStatus855,TestingStatus856,TestingStatus810C,TestingStatus810F,GoLiveDate850,GoLiveDate855,GoLiveDate856," & _
"GoLiveDate810C,GoLiveDate810F,VendorKickOffDate,Exemption,ExemptionStartDate,ExemptionEndDate,ExemptionReason," & _
"ExemptionDescription,Ownership,NECC2500,NECC3500,NECC5000,NECC10000,NECCStartDate,NECCEndDate,SPSCertificate,ProductionStatus850," & _
"ProductionStatus855,ProductionStatus856,ProductionStatus810C,ProductionStatus810F,PlatformFI850,PlatformFI855,PlatformFI856," & _
"PlatformFI810C,PlatformFI810F,ProductionDate850,ProductionDate855,ProductionDate856,ProductionDate810C,ProductionDate810F," & _
"ProductionPrepack,ProductionCrossDock,ProductionMultiStyle,ProductionProductAttribute,ProductionMasterPack,ProductionCrossDockMix," & _
"ProductionStandAloneMix,ProductionLegalEntity,FirstASNDate,FirstINVDate,SALeadDays,CrossDockLeadDays,CommunicationNotes,ProductionNotes," & _
"QU1,QU2,ISA_ID1,ISA_ID2,GS_ID1,GS_ID2,VAN,VAN2,HYBRID) " & _
"SELECT EDI_Contact_Name,EDI_Contact_Phone,EDI_Contact_Email,Platform,Status,Migration_Status,Migration_Date,Tester,Testing_Start_Date,Last_Contact," & _
"Status_850,Status_856,Status_810C,Status_810F,Status_MH10_Label,Status_PTicket,Tnotes,TS_850,TS_855,TS_856,TS_810C,TS_810F,GLD_850,GLD_855," & _
"GLD_856,GLD_810C,GLD_810F,Kick_Off_Mtg,Exemption,Exemption_Start_Date,Exemption_End_Date,Exemption_Text,Exemption_Reason,Ownership," & _
"NECC_2500,NECC_3500,NECC_5000,NECC_10000,NECC_Start_Date,NECC_End_Date,SPS_Certificate,PS_850,PS_855,PS_856,PS_810C,PS_810F,P850_FI,P855_FI," & _
"P856_FI,P810C_FI,P810F_FI,PDTS_850,PDTS_855,PDTS_856,PDTS_810C,PDTS_810F,Prepack,Cross_Dock,[M-style],PCA,Master_Pack,[XD-Mix],[SA-Mix],Legal_Entity," & _
"First_ASN,First_INV,Lead_Days,Cross_Dock_Lead_Days,CNotes,Info,QU1,QU2,ISA_ID1,ISA_ID2,GS_ID1,GS_ID2,VAN,VAN2,HYBRID " & _
"FROM tbleVendorRecord " & _
"WHERE tbleVendorRecord.Vendor_ID = VendorNumber "
我使用的MS Access中VBA並試圖運行上面的腳本,我得到的「Enter參數值「供應商編號任何想法,爲什麼這是?
編輯:
看看你的'WHERE'子句。 –
我做了,它看起來對我來說很好...供應商編號是正確的 – Maldred
看起來對我來說不正確。正如Access暗示給你的,VendorNumber背後的價值是什麼?它看起來並不是你的select語句中的一列,或者是一個變量,或者除VendorNumber之外的任何東西。如果引擎不是來自您指定的列,引擎將使用什麼值來比較它們? SQL(也不是我)知道答案,所以你會得到一個提示。 –