Showing posts with label generate. Show all posts
Showing posts with label generate. Show all posts

Sunday, March 25, 2012

Alerts not firing off jobs.

sql2k
sp3
Howdy all. I set up an Alert for deadlocks (# 1205) and have the checkbox
checked to fire off a job when it occurs. I then generate a deadlock, but the
job never gets fired off. Some important fun facts:
1; I ran dbcc traceon with 1205 and 1205 to log deadlocks.
2; I've tried running different jobs manually. They both work.Is the alert itself firing? Make sure that the EventLog
service and SQL Agent are running. Check the Event log to
make sure that it is not full. Check if the event is writing
to the Application log. There is also a topic in books
online with more information on troubleshooting alerts.
Check the topic: Troubleshooting Alerts
-Sue
On Thu, 13 Apr 2006 15:36:02 -0700, ChrisR
<ChrisR@.discussions.microsoft.com> wrote:
>sql2k
>sp3
>Howdy all. I set up an Alert for deadlocks (# 1205) and have the checkbox
>checked to fire off a job when it occurs. I then generate a deadlock, but the
>job never gets fired off. Some important fun facts:
>1; I ran dbcc traceon with 1205 and 1205 to log deadlocks.
>2; I've tried running different jobs manually. They both work.
>

Alerts not firing off jobs.

sql2k
sp3
Howdy all. I set up an Alert for deadlocks (# 1205) and have the checkbox
checked to fire off a job when it occurs. I then generate a deadlock, but th
e
job never gets fired off. Some important fun facts:
1; I ran dbcc traceon with 1205 and 1205 to log deadlocks.
2; I've tried running different jobs manually. They both work.Is the alert itself firing? Make sure that the EventLog
service and SQL Agent are running. Check the Event log to
make sure that it is not full. Check if the event is writing
to the Application log. There is also a topic in books
online with more information on troubleshooting alerts.
Check the topic: Troubleshooting Alerts
-Sue
On Thu, 13 Apr 2006 15:36:02 -0700, ChrisR
<ChrisR@.discussions.microsoft.com> wrote:

>sql2k
>sp3
>Howdy all. I set up an Alert for deadlocks (# 1205) and have the checkbox
>checked to fire off a job when it occurs. I then generate a deadlock, but t
he
>job never gets fired off. Some important fun facts:
>1; I ran dbcc traceon with 1205 and 1205 to log deadlocks.
>2; I've tried running different jobs manually. They both work.
>

Tuesday, March 6, 2012

aggregate function

The following statement fail to generate my expected result:
select A.part_id, sum( (B.total + sum(C.amount)) * D.rate)
from A, B, C , D
where B.part_id = A.part_id and C.line_id = B.line_id and convert(char(6),
B.date, 112) = D.code
It generates the error of "Cannot perform an aggregate function on an
expression containing an aggregate or a subquery.".
Could anyone please give me a hand?
Thanks in advance.
SC
----
DDL:
create Table A
( part_id char(1) primary key,
description varchar(1),
)
create Table B
(
part_id char(1),
date datetime,
line_id int,
total numeric(10,2),
primary key (part_id, date)
)
create Table C
(
line_id int,
seq int,
amount numeric(10,2)
primary key (line_id, seq )
)
create Table D
(
code char(6) primary key,
rate numeric(10,2)
)
DML:
insert into A values ( 'A', 'A' )
insert into A values ( 'B', 'B' )
insert into A values ( 'C', 'C' )
insert into B values ( 'A', '2006/01/01', 1, 10)
insert into B values ( 'A', '2006/02/01', 2, 5)
insert into B values ( 'B', '2006/01/01',3, 12)
insert into B values ( 'B', '2006/01/03',4, 10)
insert into B values ( 'B', '2006/02/01',5, 2)
insert into C values ( 1, 1, 3)
insert into C values ( 1, 2, 4)
insert into C values ( 2, 1, 5)
insert into C values ( 3, 1, -5)
insert into C values ( 3, 2, 2)
insert into D values ('200601', 1.1)
insert into D values ('200602', 1.5)
Expect result:
A 33.7
B 23.9I didn't spend time to completely work this out, but it should get you movin
g in the right direction. (The A result is what you desired, but the B resul
t is not...)
Sum Table C as a derived table (named 'C2') and THEN JOIN on it.
SELECT
A.Part_ID
, sum(( B.Total + C2.Amount ) * D.Rate )
FROM A
JOIN B
ON A.Part_ID = B.Part_ID
JOIN ( SELECT
Line_ID
, sum( Amount ) AS 'Amount'
FROM C
GROUP BY Line_ID
) C2
ON C2.Line_ID = B.Line_ID
JOIN D
ON convert( char(6), B.[Date], 112) = D.Code
GROUP BY A.Part_ID
--
Arnie Rowland, YACE*
"To be successful, your heart must accompany your knowledge."
*Yet Another certification Exam
"Squirrel" <xsquirrelx@.hotmail.com> wrote in message news:OwO5qWnlGHA.4212@.TK2MSFTNGP03.phx
.gbl...
> The following statement fail to generate my expected result:
> select A.part_id, sum( (B.total + sum(C.amount)) * D.rate)
> from A, B, C , D
> where B.part_id = A.part_id and C.line_id = B.line_id and convert(char(6),
> B.date, 112) = D.code
>
> It generates the error of "Cannot perform an aggregate function on an
> expression containing an aggregate or a subquery.".
>
> Could anyone please give me a hand?
>
> Thanks in advance.
>
> SC
> ----
> DDL:
> create Table A
> ( part_id char(1) primary key,
> description varchar(1),
> )
> create Table B
> (
> part_id char(1),
> date datetime,
> line_id int,
> total numeric(10,2),
> primary key (part_id, date)
> )
> create Table C
> (
> line_id int,
> seq int,
> amount numeric(10,2)
> primary key (line_id, seq )
> )
> create Table D
> (
> code char(6) primary key,
> rate numeric(10,2)
> )
>
> DML:
> insert into A values ( 'A', 'A' )
> insert into A values ( 'B', 'B' )
> insert into A values ( 'C', 'C' )
> insert into B values ( 'A', '2006/01/01', 1, 10)
> insert into B values ( 'A', '2006/02/01', 2, 5)
> insert into B values ( 'B', '2006/01/01',3, 12)
> insert into B values ( 'B', '2006/01/03',4, 10)
> insert into B values ( 'B', '2006/02/01',5, 2)
> insert into C values ( 1, 1, 3)
> insert into C values ( 1, 2, 4)
> insert into C values ( 2, 1, 5)
> insert into C values ( 3, 1, -5)
> insert into C values ( 3, 2, 2)
> insert into D values ('200601', 1.1)
> insert into D values ('200602', 1.5)
>
> Expect result:
> A 33.7
> B 23.9
>
>|||Hello, Squirrel
The following query returns the expected results:
SELECT Y.part_id, SUM(Y.AnotherSum*D.rate) as TheSum
FROM (
SELECT X.part_id, X.code, SUM(X.TotalPlusAmount) as AnotherSum
FROM (
SELECT B.part_id, CONVERT(char(6),B.date,112) AS code,
B.total+ISNULL((
SELECT SUM(C.amount)
FROM C WHERE B.line_id=C.line_id
),0) as TotalPlusAmount
FROM B
) X GROUP BY X.part_id, X.code
) Y INNER JOIN D ON Y.code = D.code
GROUP BY Y.part_id
Razvan|||Thanks, Razvan.
Frankly, your SQL statement is complicated to me. would you kindly explain
it to me?
Thanks again.
SC
"Razvan Socol" <rsocol@.gmail.com> wrote in message
news:1151130774.295568.163480@.m73g2000cwd.googlegroups.com...
> Hello, Squirrel
> The following query returns the expected results:
> SELECT Y.part_id, SUM(Y.AnotherSum*D.rate) as TheSum
> FROM (
> SELECT X.part_id, X.code, SUM(X.TotalPlusAmount) as AnotherSum
> FROM (
> SELECT B.part_id, CONVERT(char(6),B.date,112) AS code,
> B.total+ISNULL((
> SELECT SUM(C.amount)
> FROM C WHERE B.line_id=C.line_id
> ),0) as TotalPlusAmount
> FROM B
> ) X GROUP BY X.part_id, X.code
> ) Y INNER JOIN D ON Y.code = D.code
> GROUP BY Y.part_id
> Razvan
>|||Squirrel wrote:
> Frankly, your SQL statement is complicated to me. would you kindly explain
> it to me?
Read it from the inner-most query, like this:
First, we compute B.Total+SUM(C.Amount) for each row in B (using a
correlated subquery to get the sum of C.Amount, wrapped in an ISNULL,
just in case there are no rows in table C for a certain line_id).
Then we compute AnotherSum, as the sum of the TotalPlusAmount (the
value computed above), for each part_id and X.code; we defined earlier
that X.code is the month/year of B.date.
Then we join the above result to table D, on the column code, to get
the rate corresponding to each month/year. We compute TheSum as the sum
of AnotherSum (the value calculated above), multiplicated by the
corresponding rate, for each part_id.
Razvan|||Hi There,
You may like to try this one out exactly what razvan suggested. The
join of four tables seems reductant.
1) First taking B as base table find the sum(amount from C table ofr
lineids in B)
2) Join the derived table with D on code
3) Apply your formula (b.total+ sum(c.amt) )*rate
Select Der1.Part_ID , Sum(Tot) From (
Select Der.Part_id,Sum(Der.Total+Isnull(X,0))*D.Rate Tot From
(
Select B.part_id , b.Total ,
(
Select sum(C.amount) from C where C.line_id=B.line_id
) X ,
convert(char(6),date,112) Code from B
) Der
Inner Join D On D.Code=Der.Code
group by Der.Part_Id,D.rate
) Der1 Group by Part_id
With Warm regards
Jatinder Singh
http://jatindersingh.blogspot.com
Squirrel wrote:
> Thanks, Razvan.
> Frankly, your SQL statement is complicated to me. would you kindly explain
> it to me?
> Thanks again.
> SC
> "Razvan Socol" <rsocol@.gmail.com> wrote in message
> news:1151130774.295568.163480@.m73g2000cwd.googlegroups.com...

Thursday, February 9, 2012

Advise on Integration with FoxPro

I have a legacy system based in Fox that I need to generate reports from and I would like to use SQL Server to house some report optimized tables that are derived from the Fox data. I am currently looking at several strategies for manipulating and porting the data.

a. Linked Servers - haven't had much success linking to the OLD fox database (DOS version)
b. DTS - can't find a way around dropping and recreating all the tables every time.
c. Visual Basic App - most control but not sure if the best solution
d. Some Combo of the Above

Does anyone have any advice on what the best approach might be? Are there any other solutions to add to the mix?

Thanks for any assistance,

AllenAt this point of time, I think a good sollution can be to write a DLL in VB/VC++ which will communicate with the FOX data and return the resultset in XML format.

Then your actual app can parse through the XML document using XML DOM or SAX API and provide the data to SQL Server database. If your XML file is going to be big enough, consider using SAX API which is a light-weight alternative to XML DOM.|||I have it in production with win2000 server sp2 + sql server 2000 sp3
by using Microsoft OLEDB Provider for ODBC, so it can be done

I have problems when I want to upgrade to VFPOLEDB, and in the environment of win2003 + sql server 2000 sp3. Running OPENQUERY in QA is fine, but can't be run via SQL Agent job with the error msg

Could not initialize data source object of OLE DB provider 'VFPOLEDB'. [SQLSTATE 42000] (Error 7303) [SQLSTATE 01000] (Error 7312) OLE DB error trace [OLE/DB Provider 'VFPOLEDB' IDBInitialize::Initialize returned 0x80040e21]. [SQLSTATE 01000] (Error 7300). The step failed.

Advise on Forms Authentication

ok i am doing a system in asp.net and also using reporting services to
generate some reports for user to view.
My system consists of two parts which is the Suggestor and the Evaluator.
Firstly the suggestor will go to a aspx page whereby they can submit new
suggestions by filling up the page and before they submit the suggestion,
they had to choose from a dropdownlist box which contains all the available
Evaluator Full Name, so that this suggestion will only be sent to the choosen
Evaluator to be evaluated. And all data will be store in SQL Server 2000.
So now the suggestions need to be rejected or accepted by the evaluator and
i am using reporting services to generate the page for the evaluator to view
the suggestions that had been submitted to them. and i am not sure of how to
go about using forms authentication to allow the evaluator to login, so that
when they login successfully, they will be allow to view suggestions that is
associated to them. Do i use Active Directory login in asp.net then link to
reporting services? or is there any other method that i can use so that the
Evaluator that had been login can view their own suggestions in the reporting
services.
For your information, all the evaluator profiles are store in Active
Directory server thats why i thought of using AD login to carry out my task.
Ok in order to let u all have a clearer view of what i want to achieved, i
will use the following example.
For example now i am going to submit a suggestions. and i go to the aspx
page and fill up all the necessary data and lastly select a Evaluator from
the dropdownlist box. take for example i selected "Tan Boon Keng" as the
evaluator and i submitted my suggestion. So now "Tan Boon Keng" need to
evaluate my suggestion n inorder to evaluate the suggestion, he need to login
through some forms authentication so that he can only see the suggestions
that is related to him, n not seeing ALL the suggestions that had been
submitted. and the page where they view the suggestions is generate by
reporting services so how should i go about implementing this system to work
as what i want to achieved.
Sorry for the long post and thanks in advance...Hi, is there anybody that can help me or give me advise on how should i do
this?
i tried using forms authentication in asp.net then when evaluator login
through that page, they will be direct to the reporting services page and
they can view their suggestions only. but i not sure how to get the logon
user session id to query the database for the suggestions related to that
particular logon user.
"JiaN" wrote:
> ok i am doing a system in asp.net and also using reporting services to
> generate some reports for user to view.
> My system consists of two parts which is the Suggestor and the Evaluator.
> Firstly the suggestor will go to a aspx page whereby they can submit new
> suggestions by filling up the page and before they submit the suggestion,
> they had to choose from a dropdownlist box which contains all the available
> Evaluator Full Name, so that this suggestion will only be sent to the choosen
> Evaluator to be evaluated. And all data will be store in SQL Server 2000.
> So now the suggestions need to be rejected or accepted by the evaluator and
> i am using reporting services to generate the page for the evaluator to view
> the suggestions that had been submitted to them. and i am not sure of how to
> go about using forms authentication to allow the evaluator to login, so that
> when they login successfully, they will be allow to view suggestions that is
> associated to them. Do i use Active Directory login in asp.net then link to
> reporting services? or is there any other method that i can use so that the
> Evaluator that had been login can view their own suggestions in the reporting
> services.
> For your information, all the evaluator profiles are store in Active
> Directory server thats why i thought of using AD login to carry out my task.
> Ok in order to let u all have a clearer view of what i want to achieved, i
> will use the following example.
> For example now i am going to submit a suggestions. and i go to the aspx
> page and fill up all the necessary data and lastly select a Evaluator from
> the dropdownlist box. take for example i selected "Tan Boon Keng" as the
> evaluator and i submitted my suggestion. So now "Tan Boon Keng" need to
> evaluate my suggestion n inorder to evaluate the suggestion, he need to login
> through some forms authentication so that he can only see the suggestions
> that is related to him, n not seeing ALL the suggestions that had been
> submitted. and the page where they view the suggestions is generate by
> reporting services so how should i go about implementing this system to work
> as what i want to achieved.
> Sorry for the long post and thanks in advance...