Hi All,
When i am trying insert records wko table i am getting this error. Here my sql code. If only do select its giving the result.
INSERT INTO [dbo].[wko]([wko_workorderid], [wko_itemid],[wko_origstartdate], [wko_startdate],
[wko_origrequireddate], [wKO_requireddate],[wko_routusedflag], [wko_barcodeprintflag],
[wko_printflag], [wko_backflushflag],[wko_fwdschedflag], [wko_wIPInspflag], [wko_startqty],
[wko_origstartqty],[wko_requiredqty], [Wko_origrequiredqty], [wko_scrapqty], [wko_scrapamt],
[wko_rejectqty], [wko_rejectamt], [wko_completeqty], [wko_statuscode], [wko_workordertypecode],
[wko_lastsplitnbr], [wko_actualsetupamt],[wko_actuallabamt], [wko_actualmatlamt], [wko_actualoutplantamt],
[wko_actualvarburdamt],[wko_actualfixburdamt], [wko_actualmatlburdamt],[wko_stdlabamt], [Wko_stdmatlamt],
[wko_stdoutplantamt], [wko_stdvarburdamt],[wko_stdfixburdamt],[wko_stdmatlburdamt], [wko_estlabamt],
[wko_estmatlamt], [wko_estoutplantamt], [wko_estvarburdamt], [wko_estfixburdamt], [wko_estmatlburdamt],
[wko_closedlabamt], [wko_closedmatlamt], [wko_closedoutplantamt],[wko_closedvarburdamt],
[wko_closedfixburdamt], [wko_closedmatlburdamt],[wko_issueovershort],[wko_backflushoperationseq],
[wko_backflushlabor],[wko_labcostpluspercent], [wko_matlcostpluspercent])
Select dbo.wkotest_temp.[wko_workorderid], dbo.wkotest_temp.[wko_itemid],dbo.wkotest_temp.[wko_origstartdate], dbo.wkotest_temp.[wko_startdate],
dbo.wkotest_temp.[wko_origrequireddate], dbo.wkotest_temp.[wKO_requireddate],dbo.wkotest_temp.[wko_routusedflag], dbo.wkotest_temp.[wko_barcodeprintflag],
dbo.wkotest_temp.[wko_printflag], dbo.wkotest_temp.[wko_backflushflag],dbo.ima.[ima_fwdschedflag], dbo.wkotest_temp.[wko_wIPInspflag], dbo.wkotest_temp.[wko_startqty],
dbo.wkotest_temp.[wko_origstartqty],dbo.wkotest_temp.[wko_requiredqty], dbo.wkotest_temp.[Wko_origrequiredqty], dbo.wkotest_temp.[wko_scrapqty], dbo.wkotest_temp.[wko_scrapamt],
dbo.wkotest_temp.[wko_rejectqty], dbo.wkotest_temp.[wko_rejectamt],dbo.wkotest_temp. [wko_completeqty], dbo.wkotest_temp.[wko_statuscode], dbo.wkotest_temp.[wko_workordertypecode],
dbo.wkotest_temp.[wko_lastsplitnbr], dbo.wkotest_temp.[wko_actualsetupamt],dbo.wkotest_temp.[wko_actuallabamt], dbo.wkotest_temp.[wko_actualmatlamt], dbo.wkotest_temp.[wko_actualoutplantamt],
dbo.wkotest_temp.[wko_actualvarburdamt],dbo.wkotest_temp.[wko_actualfixburdamt],dbo.wkotest_temp. [wko_actualmatlburdamt],dbo.imc.[imc_stdlabamt], [imc_stdmatlamt],
dbo.imc.[imc_stdoutplantamt], dbo.imc.[imc_stdvarburdamt],dbo.imc.[imc_stdfixburdamt],dbo.imc.[imc_stdmatlburdamt], dbo.imc.[imc_stdlabamt],
dbo.imc.[imc_stdmatlamt], dbo.imc.[imc_stdoutplantamt], dbo.imc.[imc_stdvarburdamt], dbo.imc.[imc_stdfixburdamt],dbo.imc. [imc_stdmatlburdamt],
dbo.wkotest_temp.[wko_closedlabamt], dbo.wkotest_temp.[wko_closedmatlamt], dbo.wkotest_temp.[wko_closedoutplantamt],dbo.wkotest_temp.[wko_closedvarburdamt],
dbo.wkotest_temp.[wko_closedfixburdamt], dbo.wkotest_temp.[wko_closedmatlburdamt],dbo.wkotest_temp.[wko_issueovershort],dbo.wkotest_temp.[wko_backflushoperationseq],
dbo.wkotest_temp.[wko_backflushlabor],dbo.wkotest_temp.[wko_labcostpluspercent], dbo.wkotest_temp.[wko_matlcostpluspercent]
FROM dbo.IMC INNER JOIN
dbo.IMA ON dbo.IMC.IMC_ItemID = dbo.IMA.IMA_ItemID INNER JOIN
dbo.wkotest_Temp ON
dbo.IMA.IMA_ItemID = dbo.wkotest_Temp.WKO_ItemID COLLATE SQL_Latin1_General_CP1_CI_AS
Thanks
3 1170
Please check my code is correct. If i use select its giving the result. Only i fails in when i insert.
Hi All,
When i am trying insert records wko table i am getting this error. Here my sql code. If only do select its giving the result.
INSERT INTO [dbo].[wko]([wko_workorderid], [wko_itemid],[wko_origstartdate], [wko_startdate],
[wko_origrequireddate], [wKO_requireddate],[wko_routusedflag], [wko_barcodeprintflag],
[wko_printflag], [wko_backflushflag],[wko_fwdschedflag], [wko_wIPInspflag], [wko_startqty],
[wko_origstartqty],[wko_requiredqty], [Wko_origrequiredqty], [wko_scrapqty], [wko_scrapamt],
[wko_rejectqty], [wko_rejectamt], [wko_completeqty], [wko_statuscode], [wko_workordertypecode],
[wko_lastsplitnbr], [wko_actualsetupamt],[wko_actuallabamt], [wko_actualmatlamt], [wko_actualoutplantamt],
[wko_actualvarburdamt],[wko_actualfixburdamt], [wko_actualmatlburdamt],[wko_stdlabamt], [Wko_stdmatlamt],
[wko_stdoutplantamt], [wko_stdvarburdamt],[wko_stdfixburdamt],[wko_stdmatlburdamt], [wko_estlabamt],
[wko_estmatlamt], [wko_estoutplantamt], [wko_estvarburdamt], [wko_estfixburdamt], [wko_estmatlburdamt],
[wko_closedlabamt], [wko_closedmatlamt], [wko_closedoutplantamt],[wko_closedvarburdamt],
[wko_closedfixburdamt], [wko_closedmatlburdamt],[wko_issueovershort],[wko_backflushoperationseq],
[wko_backflushlabor],[wko_labcostpluspercent], [wko_matlcostpluspercent])
Select dbo.wkotest_temp.[wko_workorderid], dbo.wkotest_temp.[wko_itemid],dbo.wkotest_temp.[wko_origstartdate], dbo.wkotest_temp.[wko_startdate],
dbo.wkotest_temp.[wko_origrequireddate], dbo.wkotest_temp.[wKO_requireddate],dbo.wkotest_temp.[wko_routusedflag], dbo.wkotest_temp.[wko_barcodeprintflag],
dbo.wkotest_temp.[wko_printflag], dbo.wkotest_temp.[wko_backflushflag],dbo.ima.[ima_fwdschedflag], dbo.wkotest_temp.[wko_wIPInspflag], dbo.wkotest_temp.[wko_startqty],
dbo.wkotest_temp.[wko_origstartqty],dbo.wkotest_temp.[wko_requiredqty], dbo.wkotest_temp.[Wko_origrequiredqty], dbo.wkotest_temp.[wko_scrapqty], dbo.wkotest_temp.[wko_scrapamt],
dbo.wkotest_temp.[wko_rejectqty], dbo.wkotest_temp.[wko_rejectamt],dbo.wkotest_temp. [wko_completeqty], dbo.wkotest_temp.[wko_statuscode], dbo.wkotest_temp.[wko_workordertypecode],
dbo.wkotest_temp.[wko_lastsplitnbr], dbo.wkotest_temp.[wko_actualsetupamt],dbo.wkotest_temp.[wko_actuallabamt], dbo.wkotest_temp.[wko_actualmatlamt], dbo.wkotest_temp.[wko_actualoutplantamt],
dbo.wkotest_temp.[wko_actualvarburdamt],dbo.wkotest_temp.[wko_actualfixburdamt],dbo.wkotest_temp. [wko_actualmatlburdamt],dbo.imc.[imc_stdlabamt], [imc_stdmatlamt],
dbo.imc.[imc_stdoutplantamt], dbo.imc.[imc_stdvarburdamt],dbo.imc.[imc_stdfixburdamt],dbo.imc.[imc_stdmatlburdamt], dbo.imc.[imc_stdlabamt],
dbo.imc.[imc_stdmatlamt], dbo.imc.[imc_stdoutplantamt], dbo.imc.[imc_stdvarburdamt], dbo.imc.[imc_stdfixburdamt],dbo.imc. [imc_stdmatlburdamt],
dbo.wkotest_temp.[wko_closedlabamt], dbo.wkotest_temp.[wko_closedmatlamt], dbo.wkotest_temp.[wko_closedoutplantamt],dbo.wkotest_temp.[wko_closedvarburdamt],
dbo.wkotest_temp.[wko_closedfixburdamt], dbo.wkotest_temp.[wko_closedmatlburdamt],dbo.wkotest_temp.[wko_issueovershort],dbo.wkotest_temp.[wko_backflushoperationseq],
dbo.wkotest_temp.[wko_backflushlabor],dbo.wkotest_temp.[wko_labcostpluspercent], dbo.wkotest_temp.[wko_matlcostpluspercent]
FROM dbo.IMC INNER JOIN
dbo.IMA ON dbo.IMC.IMC_ItemID = dbo.IMA.IMA_ItemID INNER JOIN
dbo.wkotest_Temp ON
dbo.IMA.IMA_ItemID = dbo.wkotest_Temp.WKO_ItemID COLLATE SQL_Latin1_General_CP1_CI_AS
Thanks
I think you need to remove the INTO from INSERT. I have not looked at your code very close, so not sure that this makes a difference, but I know when we insert data with a SELECT statement, we ALWAYS remove the INTO.
Instead of ... - INSERT INTO [dbo].[wko]([wko_workorderid]
Try... - INSERT [dbo].[wko]([wko_workorderid]
Just a thought.
I think when doing a multi-line insert based on a Select statement, you dont specify your columns in the insert statement.
Example (single line insert) -
Insert into FOO
-
(ID, Data1, Data2)
-
Values
-
(1,'Foo', 'Bar')
-
Example 2 (mulit-line insert with subquery) -
Insert into FOO
-
Select ID, Data1, Data2
-
From Bar
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: leegold2 |
last post by:
I tried what's below, seemed OK, so I replaced an "IN" for the "=" in
the subquery below because of the subquery's error message. I thought
w/"IN" I'd get three (3) records returned as expected....
|
by: Nachi |
last post by:
Hi,
Urgent Help appreciated....
I am getting resultset with first condition and when try to get the
resutlset from second condition i am getting the above error in
SQL200.
I know that i am...
|
by: Zri Man |
last post by:
I have a situation that is as follows:
First an Index of what is discussed below:
FED_A ->> Federated Objected/Table that has lots of rows
LOC_B ->> Local Table which is selected and...
|
by: Rod |
last post by:
I have a client site where the code below has been working happily for at
least four months. The site is using SQL Server 7. The code is ASP.NET
Last week an error appeared related to the...
|
by: reap76 |
last post by:
I am running the following query:
if (select IntExternalAccountID from ExternalAccount) = (select IntExternalAccountID from InternalAccount)
select * from InternalAccount
where AccountPurpose=2 ...
|
by: Shals |
last post by:
Hi,
I'm using Form and a subform control within that form. Main form is
getting data from one table(Buildings) and subform is getting data from
another table(BldgDataByFloor). but both the form...
|
by: kiran2nirvan |
last post by:
hi please help in solving this
i am recieving this error"Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as...
|
by: abednegoo |
last post by:
Hi All,
I tried to find the solution for my problem, but i couldn't find it. If my problem is already solved somewhere, please provide me the link...
I'm not a developer myself, but the...
|
by: neilgilbert1234 |
last post by:
Hi Everyone,
Im sure this is an easyone, im a newbie to anything half complex in sql so any help would be greatly appreaciated.
I have one table that has two values, i need to multiply those values...
|
by: jideesh |
last post by:
---------------trigger code
create trigger DeletepurchaseItems on table_purchaseitems
for delete,update
as
begin
select * from deleted
update table_STOCK set ostock=(ostock-(select sqty from...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |