I have got a strange porblem. In the application log of the event viewer the
following error message apear:
SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
Unable to determine if the owner (sa) of job job name has server access
(reason: Unable to connect to server - check SQL Server and SQL Server Agent
errorlogs).
This error message does not apear in the SQL server log or the SQL server
agent log. In the SQL server I get the message that the job run succesfull.
This is correct because the job runs succesful. The error message in the
event viewer seems to be not correct.
The happens on a SQL server 2000 cluster environment with Windows Server 2003.
Hopefully someone can help me with this problemHi
"cas" wrote:
> I have got a strange porblem. In the application log of the event viewer the
> following error message apear:
> SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
> Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
> Unable to determine if the owner (sa) of job job name has server access
> (reason: Unable to connect to server - check SQL Server and SQL Server Agent
> errorlogs).
> This error message does not apear in the SQL server log or the SQL server
> agent log. In the SQL server I get the message that the job run succesfull.
> This is correct because the job runs succesful. The error message in the
> event viewer seems to be not correct.
> The happens on a SQL server 2000 cluster environment with Windows Server 2003.
> Hopefully someone can help me with this problem
This sounds like you have something similar to
http://support.microsoft.com/default.aspx/kb/286253 although not the same
message it could be a conflict occurring when two jobs are run at the same
time. Have you checked the schedules for your jobs?
John|||John,
This is the only job that is scheduled at 08:00 in the morning. This is not
the same as in http://support.microsoft.com/default.aspx/kb/286253
The error message only apear in the event viewer and not in SQL logs. In SQL
server the job is succeeded, and this is correct. I can see that the results
of the job are OK.
"John Bell" wrote:
> Hi
> "cas" wrote:
> > I have got a strange porblem. In the application log of the event viewer the
> > following error message apear:
> > SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
> > Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
> > Unable to determine if the owner (sa) of job job name has server access
> > (reason: Unable to connect to server - check SQL Server and SQL Server Agent
> > errorlogs).
> >
> > This error message does not apear in the SQL server log or the SQL server
> > agent log. In the SQL server I get the message that the job run succesfull.
> > This is correct because the job runs succesful. The error message in the
> > event viewer seems to be not correct.
> > The happens on a SQL server 2000 cluster environment with Windows Server 2003.
> > Hopefully someone can help me with this problem
> This sounds like you have something similar to
> http://support.microsoft.com/default.aspx/kb/286253 although not the same
> message it could be a conflict occurring when two jobs are run at the same
> time. Have you checked the schedules for your jobs?
> John|||"cas" wrote:
> John,
> This is the only job that is scheduled at 08:00 in the morning. This is not
> the same as in http://support.microsoft.com/default.aspx/kb/286253
> The error message only apear in the event viewer and not in SQL logs. In SQL
> server the job is succeeded, and this is correct. I can see that the results
> of the job are OK.
>
So you haven't tried changing the schedule to see if it still occurs?
John
Showing posts with label scheduled. Show all posts
Showing posts with label scheduled. Show all posts
Sunday, February 19, 2012
error message in event viewer but not in SQL server log
I have got a strange porblem. In the application log of the event viewer the
following error message apear:
SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
Unable to determine if the owner (sa) of job job name has server access
(reason: Unable to connect to server - check SQL Server and SQL Server Agent
errorlogs).
This error message does not apear in the SQL server log or the SQL server
agent log. In the SQL server I get the message that the job run succesfull.
This is correct because the job runs succesful. The error message in the
event viewer seems to be not correct.
The happens on a SQL server 2000 cluster environment with Windows Server 2003.
Hopefully someone can help me with this problem
Hi
"cas" wrote:
> I have got a strange porblem. In the application log of the event viewer the
> following error message apear:
> SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
> Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
> Unable to determine if the owner (sa) of job job name has server access
> (reason: Unable to connect to server - check SQL Server and SQL Server Agent
> errorlogs).
> This error message does not apear in the SQL server log or the SQL server
> agent log. In the SQL server I get the message that the job run succesfull.
> This is correct because the job runs succesful. The error message in the
> event viewer seems to be not correct.
> The happens on a SQL server 2000 cluster environment with Windows Server 2003.
> Hopefully someone can help me with this problem
This sounds like you have something similar to
http://support.microsoft.com/default.aspx/kb/286253 although not the same
message it could be a conflict occurring when two jobs are run at the same
time. Have you checked the schedules for your jobs?
John
|||John,
This is the only job that is scheduled at 08:00 in the morning. This is not
the same as in http://support.microsoft.com/default.aspx/kb/286253
The error message only apear in the event viewer and not in SQL logs. In SQL
server the job is succeeded, and this is correct. I can see that the results
of the job are OK.
"John Bell" wrote:
> Hi
> "cas" wrote:
>
> This sounds like you have something similar to
> http://support.microsoft.com/default.aspx/kb/286253 although not the same
> message it could be a conflict occurring when two jobs are run at the same
> time. Have you checked the schedules for your jobs?
> John
|||"cas" wrote:
> John,
> This is the only job that is scheduled at 08:00 in the morning. This is not
> the same as in http://support.microsoft.com/default.aspx/kb/286253
> The error message only apear in the event viewer and not in SQL logs. In SQL
> server the job is succeeded, and this is correct. I can see that the results
> of the job are OK.
>
So you haven't tried changing the schedule to see if it still occurs?
John
following error message apear:
SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
Unable to determine if the owner (sa) of job job name has server access
(reason: Unable to connect to server - check SQL Server and SQL Server Agent
errorlogs).
This error message does not apear in the SQL server log or the SQL server
agent log. In the SQL server I get the message that the job run succesfull.
This is correct because the job runs succesful. The error message in the
event viewer seems to be not correct.
The happens on a SQL server 2000 cluster environment with Windows Server 2003.
Hopefully someone can help me with this problem
Hi
"cas" wrote:
> I have got a strange porblem. In the application log of the event viewer the
> following error message apear:
> SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
> Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
> Unable to determine if the owner (sa) of job job name has server access
> (reason: Unable to connect to server - check SQL Server and SQL Server Agent
> errorlogs).
> This error message does not apear in the SQL server log or the SQL server
> agent log. In the SQL server I get the message that the job run succesfull.
> This is correct because the job runs succesful. The error message in the
> event viewer seems to be not correct.
> The happens on a SQL server 2000 cluster environment with Windows Server 2003.
> Hopefully someone can help me with this problem
This sounds like you have something similar to
http://support.microsoft.com/default.aspx/kb/286253 although not the same
message it could be a conflict occurring when two jobs are run at the same
time. Have you checked the schedules for your jobs?
John
|||John,
This is the only job that is scheduled at 08:00 in the morning. This is not
the same as in http://support.microsoft.com/default.aspx/kb/286253
The error message only apear in the event viewer and not in SQL logs. In SQL
server the job is succeeded, and this is correct. I can see that the results
of the job are OK.
"John Bell" wrote:
> Hi
> "cas" wrote:
>
> This sounds like you have something similar to
> http://support.microsoft.com/default.aspx/kb/286253 although not the same
> message it could be a conflict occurring when two jobs are run at the same
> time. Have you checked the schedules for your jobs?
> John
|||"cas" wrote:
> John,
> This is the only job that is scheduled at 08:00 in the morning. This is not
> the same as in http://support.microsoft.com/default.aspx/kb/286253
> The error message only apear in the event viewer and not in SQL logs. In SQL
> server the job is succeeded, and this is correct. I can see that the results
> of the job are OK.
>
So you haven't tried changing the schedule to see if it still occurs?
John
error message in event viewer but not in SQL server log
I have got a strange porblem. In the application log of the event viewer the
following error message apear:
SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
Unable to determine if the owner (sa) of job job name has server access
(reason: Unable to connect to server - check SQL Server and SQL Server Agent
errorlogs).
This error message does not apear in the SQL server log or the SQL server
agent log. In the SQL server I get the message that the job run succesfull.
This is correct because the job runs succesful. The error message in the
event viewer seems to be not correct.
The happens on a SQL server 2000 cluster environment with Windows Server 200
3.
Hopefully someone can help me with this problemHi
"cas" wrote:
> I have got a strange porblem. In the application log of the event viewer t
he
> following error message apear:
> SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
> Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed
.
> Unable to determine if the owner (sa) of job job name has server access
> (reason: Unable to connect to server - check SQL Server and SQL Server Age
nt
> errorlogs).
> This error message does not apear in the SQL server log or the SQL server
> agent log. In the SQL server I get the message that the job run succesfull
.
> This is correct because the job runs succesful. The error message in the
> event viewer seems to be not correct.
> The happens on a SQL server 2000 cluster environment with Windows Server 2
003.
> Hopefully someone can help me with this problem
This sounds like you have something similar to
http://support.microsoft.com/default.aspx/kb/286253 although not the same
message it could be a conflict occurring when two jobs are run at the same
time. Have you checked the schedules for your jobs?
John|||John,
This is the only job that is scheduled at 08:00 in the morning. This is not
the same as in http://support.microsoft.com/default.aspx/kb/286253
The error message only apear in the event viewer and not in SQL logs. In SQL
server the job is succeeded, and this is correct. I can see that the results
of the job are OK.
"John Bell" wrote:
> Hi
> "cas" wrote:
>
> This sounds like you have something similar to
> http://support.microsoft.com/default.aspx/kb/286253 although not the same
> message it could be a conflict occurring when two jobs are run at the same
> time. Have you checked the schedules for your jobs?
> John|||"cas" wrote:
> John,
> This is the only job that is scheduled at 08:00 in the morning. This is no
t
> the same as in http://support.microsoft.com/default.aspx/kb/286253
> The error message only apear in the event viewer and not in SQL logs. In S
QL
> server the job is succeeded, and this is correct. I can see that the resul
ts
> of the job are OK.
>
So you haven't tried changing the schedule to see if it still occurs?
John
following error message apear:
SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed.
Unable to determine if the owner (sa) of job job name has server access
(reason: Unable to connect to server - check SQL Server and SQL Server Agent
errorlogs).
This error message does not apear in the SQL server log or the SQL server
agent log. In the SQL server I get the message that the job run succesfull.
This is correct because the job runs succesful. The error message in the
event viewer seems to be not correct.
The happens on a SQL server 2000 cluster environment with Windows Server 200
3.
Hopefully someone can help me with this problemHi
"cas" wrote:
> I have got a strange porblem. In the application log of the event viewer t
he
> following error message apear:
> SQL Server Scheduled Job 'job name' (0xE90E17B42DE94240935ED80B7702BD49) -
> Status: Failed - Invoked on: 2007-02-13 08:00:00 - Message: The job failed
.
> Unable to determine if the owner (sa) of job job name has server access
> (reason: Unable to connect to server - check SQL Server and SQL Server Age
nt
> errorlogs).
> This error message does not apear in the SQL server log or the SQL server
> agent log. In the SQL server I get the message that the job run succesfull
.
> This is correct because the job runs succesful. The error message in the
> event viewer seems to be not correct.
> The happens on a SQL server 2000 cluster environment with Windows Server 2
003.
> Hopefully someone can help me with this problem
This sounds like you have something similar to
http://support.microsoft.com/default.aspx/kb/286253 although not the same
message it could be a conflict occurring when two jobs are run at the same
time. Have you checked the schedules for your jobs?
John|||John,
This is the only job that is scheduled at 08:00 in the morning. This is not
the same as in http://support.microsoft.com/default.aspx/kb/286253
The error message only apear in the event viewer and not in SQL logs. In SQL
server the job is succeeded, and this is correct. I can see that the results
of the job are OK.
"John Bell" wrote:
> Hi
> "cas" wrote:
>
> This sounds like you have something similar to
> http://support.microsoft.com/default.aspx/kb/286253 although not the same
> message it could be a conflict occurring when two jobs are run at the same
> time. Have you checked the schedules for your jobs?
> John|||"cas" wrote:
> John,
> This is the only job that is scheduled at 08:00 in the morning. This is no
t
> the same as in http://support.microsoft.com/default.aspx/kb/286253
> The error message only apear in the event viewer and not in SQL logs. In S
QL
> server the job is succeeded, and this is correct. I can see that the resul
ts
> of the job are OK.
>
So you haven't tried changing the schedule to see if it still occurs?
John
Error message in a job, SQLSTATE 42S02 (Error 208)
I have a scheduled job where it's failing intermittently every few days.
The job fails in one of two steps, but with the same error above.
Step 18 is where I do a drop of the table and a create of the table, and
its indexes. It doesn't fail here, but fails in one of the next two
steps.
Step 19 is an insert into the table created in step 18. It takes a
source table, and puts into it mostly the same information, except that
it sums stuff up by purcase order instead of by line item. It also does
some max(dates) to record the most recent activity on the items in this
summary table.
Step 20 is an insert into the same table from the same source table as
in step 19, except that it processes everything excluded from the first
pass.
It's failed on step 19 & step 20 over the last several days. The error
message itself displays like:
"Executed as user: Mydomain\Mysqlaccount. Invalid Object Name
'tablename'. [SQLSTATE 42S02] (Error 208). The step failed."
To fix the problem, we've simply re-started in the failed step (did not
re-create the table, only picked up with the insert into it), and the
job has run to completion.
One thing that has occurred to me is to have the table drop, create and
load all in stored procedures, instead of how it is now - in TSQL code
within the batch job. I don't know if this would fix the problem though.
Any ideas as to what's happening? The info I've found on the 42S02
error hasn't been much help yet.
SCBased on the fact that I can't see your DTS workflow diagram, I'd urge you t
o
check the workflow.
ML|||> Based on the fact that I can't see your DTS workflow diagram, I'd urge you toed">
> check the workflow.
There is no DTS Workflow diagram.
These are just steps in a job created under the Management folder in
Enterprise Manager, under the SQL Server Agent, under the Jobs link.
It's 3 steps inside 1 of those jobs that is dying on step 19 or 20 with
the 42S02 Error 208 message.
18 runs okay, 19 & 20 are the ones that have died intermittently.
The steps are:
-- Step 18
CREATE TABLE [dbo].[posummary] (
[sSalesOrganization] [varchar] (8) NULL ,
[sSalesGroup] [varchar] (3) NULL ,
[sSalesRepCode] [varchar] (10) NULL ,
[sDistributionChannel] [varchar] (2) NULL ,
[sSoldTo] [varchar] (10) NULL ,
[sShipTo] [varchar] (10) NULL ,
[sCustName1] [varchar] (45) NULL ,
[sCustName2] [varchar] (35) NULL ,
[PO_Num] [varchar] (20) NULL ,
[Order_date] [smalldatetime] NULL ,
[Req_Ship_Date] [smalldatetime] NULL ,
[Inv_Date] [smalldatetime] NULL ,
[Inv_Nr] [varchar] (10) NULL ,
[lOrderQuantity] [int] NULL ,
[lOrderValue] [money] NULL ,
[lShipValue] [money] NULL ,
[OpenVal] [money] NULL ,
[lShipQuantity] [int] NULL ,
[sAccountSoldTo] [varchar] (10) NULL ,
[sMasterSoldTo] [varchar] (10) NULL
) ON [PRIMARY]
GO
CREATE INDEX [posummary] ON [dbo].[posummary]([sSalesOrganization],
[sDistributionChannel], [sSalesGroup], [sSalesRepCode], [sSoldTo],
[sShipTo], [PO_Num], [Inv_Nr]) ON [PRIMARY]
GO
CREATE INDEX [sorg] ON [dbo].[posummary]([sSalesOrganization]) ON
[PRIMARY]
GO
CREATE INDEX [distchnl] ON [dbo].[posummary]([sDistributionChannel])
ON [PRIMARY]
GO
CREATE INDEX [sgroup] ON [dbo].[posummary]([sSalesGroup]) ON [PRIMARY]
GO
CREATE INDEX [sRep] ON [dbo].[posummary]([sSalesRepCode]) ON [PRIMARY]
GO
CREATE INDEX [SoldTo] ON [dbo].[posummary]([sSoldTo]) ON [PRIMARY]
GO
CREATE INDEX [ShipTo] ON [dbo].[posummary]([sShipTo]) ON [PRIMARY]
GO
CREATE INDEX [PO] ON [dbo].[posummary]([PO_Num]) ON [PRIMARY]
GO
CREATE INDEX [InvNr] ON [dbo].[posummary]([Inv_Nr]) ON [PRIMARY]
GO
CREATE INDEX [Ord Date] ON [dbo].[posummary]([Order_date]) ON [PRIMARY]
GO
CREATE INDEX [ACCTSOLDTO] ON [dbo].[posummary]([sAccountSoldTo]) ON
[PRIMARY]
GO
CREATE INDEX [MASTERSOLDTO] ON [dbo].[posummary]([sMasterSoldTo]) ON
[PRIMARY]
GO
-- Step 19
insert into posummary
select
podetail.ssalesorganization,
podetail.Ssalesgroup,
podetail.ssalesrepcode,
podetail.sDistributionChannel,
podetail.ssoldto,
podetail.sshipto,
max(tblmaster_shipto.scustname1) as Custname1,
max(tblmaster_shipto.scustname2) as Custname2,
PO_Num,
max(Order_Date) as Order_Date,
max(Req_Ship_Date) as Req_Ship_Date,
max(Inv_Date) as Inv_Date,
max(Inv_Nr) as Inv_Nr,
sum(lorderquantity) as lorderquantity,
sum(lordervalue) as lordervalue,
sum(lshipvalue) as lshipvalue,
sum(lordervalue) - sum(lshipvalue) as Openval,
sum(lshipquantity) as lshipquantity,
max(tblmaster_accountsoldto.saccountsoldto) as AccountSoldTo,
max(tblmaster_accountsoldto.smastersoldto) as MasterSoldTo
from podetail
left outer join tblmaster_shipto on
((tblmaster_shipto.ssoldto = podetail.ssoldto) and
(tblmaster_shipto.sshipto = podetail.sshipto) and
(tblmaster_shipto.ssalesgrp = podetail.ssalesgroup) and
(tblmaster_shipto.ssalesrep = podetail.ssalesrepcode) and
(tblmaster_shipto.sdistrchnl = podetail.sdistributionchannel))
left outer join tblmaster_accountsoldto on
(tblmaster_accountsoldto.ssoldto = podetail.ssoldto)
and (tblmaster_accountsoldto.ssalesgroup not in ('R1','R2','R3'))
where podetail.sdistributionchannel != 'WL'
group by
podetail.ssalesorganization,
podetail.Ssalesgroup,
podetail.ssalesrepcode,
podetail.sDistributionChannel,
podetail.ssoldto,
podetail.sshipto,
PO_Num
-- step 20
insert into posummary
select
podetail.ssalesorganization,
podetail.Ssalesgroup,
podetail.ssalesrepcode,
podetail.sDistributionChannel,
podetail.ssoldto,
podetail.sshipto,
max(tblmaster_shipto.scustname1) as Custname1,
max(tblmaster_shipto.scustname2) as Custname2,
PO_Num,
max(Order_Date) as Order_Date,
max(Req_Ship_Date) as Req_Ship_Date,
max(Inv_Date) as Inv_Date,
max(Inv_Nr) as Inv_Nr,
sum(lorderquantity) as lorderquantity,
sum(lordervalue) as lordervalue,
sum(lshipvalue) as lshipvalue,
sum(lordervalue) - sum(lshipvalue) as Openval,
sum(lshipquantity) as lshipquantity,
max(tblmaster_accountsoldto.saccountsoldto) as AccountSoldTo,
max(tblmaster_accountsoldto.smastersoldto) as MasterSoldTo
from podetail
left outer join tblmaster_shipto on
((tblmaster_shipto.ssoldto = podetail.ssoldto) and
(tblmaster_shipto.sshipto = podetail.sshipto) and
(tblmaster_shipto.ssalesgrp = podetail.ssalesgroup) and
(tblmaster_shipto.ssalesrep = podetail.ssalesrepcode) and
(tblmaster_shipto.sdistrchnl = podetail.sdistributionchannel))
left outer join tblmaster_accountsoldto on
(tblmaster_accountsoldto.ssoldto = podetail.ssoldto)
and (tblmaster_accountsoldto.ssalesgroup in ('R1','R2','R3'))
where podetail.sdistributionchannel = 'WL'
group by
podetail.ssalesorganization,
podetail.Ssalesgroup,
podetail.ssalesrepcode,
podetail.sDistributionChannel,
podetail.ssoldto,
podetail.sshipto,
PO_Num|||Your insert statement is not optimal - it's missing the column list for the
destination table. Maybe that's it.
ML|||> Your insert statement is not optimal - it's missing the column list for the
> destination table. Maybe that's it.
You mean where I have:
insert into posummary
select
podetail.ssalesorganization,
podetail.Ssalesgroup,
podetail.ssalesrepcode,
podetail.sDistributionChannel,
podetail.ssoldto,
podetail.sshipto......
it should now read:
insert into posummary
select
sSalesOrganization = podetail.ssalesorganization,
sSalesGroup = podetail.Ssalesgroup,
sSalesRepCode = podetail.ssalesrepcode,
sDistributionChannel = podetail.sDistributionChannel,
sSoldTo = podetail.ssoldto,
sShipTo = podetail.sshipto,
Is that correct?
I didn't think that made a lot of difference. The error message surely
doesn't lead you in that direction. The error message makes you think
it cannot find the table.
BC
The job fails in one of two steps, but with the same error above.
Step 18 is where I do a drop of the table and a create of the table, and
its indexes. It doesn't fail here, but fails in one of the next two
steps.
Step 19 is an insert into the table created in step 18. It takes a
source table, and puts into it mostly the same information, except that
it sums stuff up by purcase order instead of by line item. It also does
some max(dates) to record the most recent activity on the items in this
summary table.
Step 20 is an insert into the same table from the same source table as
in step 19, except that it processes everything excluded from the first
pass.
It's failed on step 19 & step 20 over the last several days. The error
message itself displays like:
"Executed as user: Mydomain\Mysqlaccount. Invalid Object Name
'tablename'. [SQLSTATE 42S02] (Error 208). The step failed."
To fix the problem, we've simply re-started in the failed step (did not
re-create the table, only picked up with the insert into it), and the
job has run to completion.
One thing that has occurred to me is to have the table drop, create and
load all in stored procedures, instead of how it is now - in TSQL code
within the batch job. I don't know if this would fix the problem though.
Any ideas as to what's happening? The info I've found on the 42S02
error hasn't been much help yet.
SCBased on the fact that I can't see your DTS workflow diagram, I'd urge you t
o
check the workflow.
ML|||> Based on the fact that I can't see your DTS workflow diagram, I'd urge you toed">
> check the workflow.
There is no DTS Workflow diagram.
These are just steps in a job created under the Management folder in
Enterprise Manager, under the SQL Server Agent, under the Jobs link.
It's 3 steps inside 1 of those jobs that is dying on step 19 or 20 with
the 42S02 Error 208 message.
18 runs okay, 19 & 20 are the ones that have died intermittently.
The steps are:
-- Step 18
CREATE TABLE [dbo].[posummary] (
[sSalesOrganization] [varchar] (8) NULL ,
[sSalesGroup] [varchar] (3) NULL ,
[sSalesRepCode] [varchar] (10) NULL ,
[sDistributionChannel] [varchar] (2) NULL ,
[sSoldTo] [varchar] (10) NULL ,
[sShipTo] [varchar] (10) NULL ,
[sCustName1] [varchar] (45) NULL ,
[sCustName2] [varchar] (35) NULL ,
[PO_Num] [varchar] (20) NULL ,
[Order_date] [smalldatetime] NULL ,
[Req_Ship_Date] [smalldatetime] NULL ,
[Inv_Date] [smalldatetime] NULL ,
[Inv_Nr] [varchar] (10) NULL ,
[lOrderQuantity] [int] NULL ,
[lOrderValue] [money] NULL ,
[lShipValue] [money] NULL ,
[OpenVal] [money] NULL ,
[lShipQuantity] [int] NULL ,
[sAccountSoldTo] [varchar] (10) NULL ,
[sMasterSoldTo] [varchar] (10) NULL
) ON [PRIMARY]
GO
CREATE INDEX [posummary] ON [dbo].[posummary]([sSalesOrganization],
[sDistributionChannel], [sSalesGroup], [sSalesRepCode], [sSoldTo],
[sShipTo], [PO_Num], [Inv_Nr]) ON [PRIMARY]
GO
CREATE INDEX [sorg] ON [dbo].[posummary]([sSalesOrganization]) ON
[PRIMARY]
GO
CREATE INDEX [distchnl] ON [dbo].[posummary]([sDistributionChannel])
ON [PRIMARY]
GO
CREATE INDEX [sgroup] ON [dbo].[posummary]([sSalesGroup]) ON [PRIMARY]
GO
CREATE INDEX [sRep] ON [dbo].[posummary]([sSalesRepCode]) ON [PRIMARY]
GO
CREATE INDEX [SoldTo] ON [dbo].[posummary]([sSoldTo]) ON [PRIMARY]
GO
CREATE INDEX [ShipTo] ON [dbo].[posummary]([sShipTo]) ON [PRIMARY]
GO
CREATE INDEX [PO] ON [dbo].[posummary]([PO_Num]) ON [PRIMARY]
GO
CREATE INDEX [InvNr] ON [dbo].[posummary]([Inv_Nr]) ON [PRIMARY]
GO
CREATE INDEX [Ord Date] ON [dbo].[posummary]([Order_date]) ON [PRIMARY]
GO
CREATE INDEX [ACCTSOLDTO] ON [dbo].[posummary]([sAccountSoldTo]) ON
[PRIMARY]
GO
CREATE INDEX [MASTERSOLDTO] ON [dbo].[posummary]([sMasterSoldTo]) ON
[PRIMARY]
GO
-- Step 19
insert into posummary
select
podetail.ssalesorganization,
podetail.Ssalesgroup,
podetail.ssalesrepcode,
podetail.sDistributionChannel,
podetail.ssoldto,
podetail.sshipto,
max(tblmaster_shipto.scustname1) as Custname1,
max(tblmaster_shipto.scustname2) as Custname2,
PO_Num,
max(Order_Date) as Order_Date,
max(Req_Ship_Date) as Req_Ship_Date,
max(Inv_Date) as Inv_Date,
max(Inv_Nr) as Inv_Nr,
sum(lorderquantity) as lorderquantity,
sum(lordervalue) as lordervalue,
sum(lshipvalue) as lshipvalue,
sum(lordervalue) - sum(lshipvalue) as Openval,
sum(lshipquantity) as lshipquantity,
max(tblmaster_accountsoldto.saccountsoldto) as AccountSoldTo,
max(tblmaster_accountsoldto.smastersoldto) as MasterSoldTo
from podetail
left outer join tblmaster_shipto on
((tblmaster_shipto.ssoldto = podetail.ssoldto) and
(tblmaster_shipto.sshipto = podetail.sshipto) and
(tblmaster_shipto.ssalesgrp = podetail.ssalesgroup) and
(tblmaster_shipto.ssalesrep = podetail.ssalesrepcode) and
(tblmaster_shipto.sdistrchnl = podetail.sdistributionchannel))
left outer join tblmaster_accountsoldto on
(tblmaster_accountsoldto.ssoldto = podetail.ssoldto)
and (tblmaster_accountsoldto.ssalesgroup not in ('R1','R2','R3'))
where podetail.sdistributionchannel != 'WL'
group by
podetail.ssalesorganization,
podetail.Ssalesgroup,
podetail.ssalesrepcode,
podetail.sDistributionChannel,
podetail.ssoldto,
podetail.sshipto,
PO_Num
-- step 20
insert into posummary
select
podetail.ssalesorganization,
podetail.Ssalesgroup,
podetail.ssalesrepcode,
podetail.sDistributionChannel,
podetail.ssoldto,
podetail.sshipto,
max(tblmaster_shipto.scustname1) as Custname1,
max(tblmaster_shipto.scustname2) as Custname2,
PO_Num,
max(Order_Date) as Order_Date,
max(Req_Ship_Date) as Req_Ship_Date,
max(Inv_Date) as Inv_Date,
max(Inv_Nr) as Inv_Nr,
sum(lorderquantity) as lorderquantity,
sum(lordervalue) as lordervalue,
sum(lshipvalue) as lshipvalue,
sum(lordervalue) - sum(lshipvalue) as Openval,
sum(lshipquantity) as lshipquantity,
max(tblmaster_accountsoldto.saccountsoldto) as AccountSoldTo,
max(tblmaster_accountsoldto.smastersoldto) as MasterSoldTo
from podetail
left outer join tblmaster_shipto on
((tblmaster_shipto.ssoldto = podetail.ssoldto) and
(tblmaster_shipto.sshipto = podetail.sshipto) and
(tblmaster_shipto.ssalesgrp = podetail.ssalesgroup) and
(tblmaster_shipto.ssalesrep = podetail.ssalesrepcode) and
(tblmaster_shipto.sdistrchnl = podetail.sdistributionchannel))
left outer join tblmaster_accountsoldto on
(tblmaster_accountsoldto.ssoldto = podetail.ssoldto)
and (tblmaster_accountsoldto.ssalesgroup in ('R1','R2','R3'))
where podetail.sdistributionchannel = 'WL'
group by
podetail.ssalesorganization,
podetail.Ssalesgroup,
podetail.ssalesrepcode,
podetail.sDistributionChannel,
podetail.ssoldto,
podetail.sshipto,
PO_Num|||Your insert statement is not optimal - it's missing the column list for the
destination table. Maybe that's it.
ML|||> Your insert statement is not optimal - it's missing the column list for the
> destination table. Maybe that's it.
You mean where I have:
insert into posummary
select
podetail.ssalesorganization,
podetail.Ssalesgroup,
podetail.ssalesrepcode,
podetail.sDistributionChannel,
podetail.ssoldto,
podetail.sshipto......
it should now read:
insert into posummary
select
sSalesOrganization = podetail.ssalesorganization,
sSalesGroup = podetail.Ssalesgroup,
sSalesRepCode = podetail.ssalesrepcode,
sDistributionChannel = podetail.sDistributionChannel,
sSoldTo = podetail.ssoldto,
sShipTo = podetail.sshipto,
Is that correct?
I didn't think that made a lot of difference. The error message surely
doesn't lead you in that direction. The error message makes you think
it cannot find the table.
BC
Subscribe to:
Posts (Atom)