|
This article[^] should give you the information you need.
Paul Marfleet
|
|
|
|
|
I have this query that works as it is. I want to modify it so that I do not see Alarm errors less than 50.
I guess it would have to be a sub query to this;
SELECT WaysideName, ST, AlarmMessage, COUNT(AlarmMessage) AS Error_Count, CONVERT(char(10), EventDate, 111) as ErrorDate
FROM AlarmsList
where EventDate >@StartDate and EventDate <dateadd(day, 1,@enddate)="" and="" alarmmessage="" not="" like="" ('%off')="" ('%restored')="" <=""> 'OPERATIONAL AND HEALTHY'
GROUP BY WaysideName, ST, AlarmMessage, CONVERT(char(10), EventDate, 111)
Thanks,
|
|
|
|
|
Try this:
SELECT WaysideName, ST, AlarmMessage, COUNT(AlarmMessage) AS Error_Count, CONVERT(char(10), EventDate, 111) as ErrorDate
FROM AlarmsList
where EventDate >@StartDate and EventDate 'OPERATIONAL AND HEALTHY'
GROUP BY WaysideName, ST, AlarmMessage, CONVERT(char(10), EventDate, 111)
HAVING COUNT(AlarmMessage) >= 50
Adding the HAVING clause modifies the query so that only rows with an alarm message count >=50 are included in the output.
Paul Marfleet
|
|
|
|
|
Thanks Paul. That did the trick. Boy was that simple!
|
|
|
|
|
Thanks. The important thing to remember here is that the WHERE and HAVING clauses provide different ways of filtering the output of a query.
A WHERE clause is used to filter non-aggregated data.
A HAVING clause is used in conjunction with a GROUP BY clause to filter data aggregated in that GROUP BY clause.
Paul Marfleet
|
|
|
|
|
Thank You.
It is always a good day when you learn something new!
Regards,
Brian
|
|
|
|
|
Hi!
I have the following two stored proceures:
SP1:
Create PROCEDURE SP1
@arg1 varchar(100),
@arg2 varchar(100) out
AS
BEGIN
SET @arg2=arg1+': SP1 Data'
return
END
SP2:
Create PROCEDURE SP2
AS
BEGIN
Declare @argloc varchar(100)
EXEC SP1 'SP2 Data',@argloc
print @argloc
END
On calling SP2 i want result like:
SP2 Data: SP1 Data
But it returns:
SP2 Data
How can can i fix this problem?
Thanks!
|
|
|
|
|
This should work:
Create PROCEDURE SP2
AS
BEGIN
Declare @argloc varchar(100)
EXEC SP1 'SP2 Data',@argloc OUTPUT
print @argloc
END
You needed to mark @argloc with the OUTPUT keyword in order for this variable to receive the output value from SP1.
Paul Marfleet
|
|
|
|
|
I tried and it succeeded because of your nice suggestion.
Thanks!
|
|
|
|
|
That's OK. As long as my advice was helpful.
Paul Marfleet
|
|
|
|
|
Is there any mechanism to refresh a dataset automatically when the data source ,lets say
a table in SqlServer, is updated, deleted or inserted. No periodic fill or execuete a sql statement please.
Thanks
|
|
|
|
|
muharrem wrote: No periodic fill or execuete a sql statement please.
Why not?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I don't know when the original data source is updated by other user or
an other aplication.
My project is going to be part of a plant automation system. So the events from the
plant level my arise in very short time duration or too long. It depends on the condition
at that moment. So if I periodically fill my data set, what will be the period?
It is very difficult to gess id advance. Having it too short will bring unnecessary workload
for the system. Or having it too long will cause to miss the some indermediate update in
the data source.
I am not very good on Ado.Net. I need to know ,if possible, can I have my client application
to refresh its dataset (automatically) from the data source when it is updated.
Thanks for reply, anyhow
|
|
|
|
|
The best way to make this , by using triggers with endpoint in SqlServer 2005
|
|
|
|
|
Can you be more specific please?
And consider MySQL too.
Thanks,
Muharrem
|
|
|
|
|
i have few questions before the forum...
first can we connect sql 2000 enterprise manager to sql 2005 server?
second can we connect to sql2005 server from query analyser of 2000?
do we have the client tools for sql 2005 server?
|
|
|
|
|
nicetohaveyou wrote: first can we connect sql 2000 enterprise manager to sql 2005 server?
second can we connect to sql2005 server from query analyser of 2000?
Why would you want to do this? If you have SQL Server 2005, install the SQL 2005 client tools.
nicetohaveyou wrote: do we have the client tools for sql 2005 server?
Only you can answer this question...
Paul Marfleet
|
|
|
|
|
nicetohaveyou wrote: first can we connect sql 2000 enterprise manager to sql 2005 server?
I tried it and, no.. you'll get an error when you connect to sql server 2005 from SQL Server 2000 enterprise manager.
nicetohaveyou wrote: second can we connect to sql2005 server from query analyser of 2000?
Yes...
nicetohaveyou wrote: do we have the client tools for sql 2005 server?
If you need free tools, you can use MS SQL Server 2005 express edition + SQL Server management studio. you can get them all free here[^]
Select to download "Microsoft SQL Server 2005 Express Edition with Advanced Services"
|
|
|
|
|
Hello,
I want to write a sql statement to create a table with one field which is a decimal.But it doesn't work.
I did the following
Create Table Purchase (Name varchar,Amount numeric(10,2))
Prithaa
|
|
|
|
|
Prithaa This Work fine Try it Again;
|
|
|
|
|
Actually you are not giving the size of varchar so by default it will take varchar(1) and you will not be able to insert the record which is greater than 1 character. You have to do like this:-
Create Table Purchase (Name varchar(50),Amount numeric(10,2))
|
|
|
|
|
hello
i am gayatri patil
i have two table tAnalyst and tUser
tAnalyst:-
UserId varchar(20) notnull
CreateDate datetime(8) notnull
UpdateDate datetime(8) allow Null
tUser table:-
UserId varchar(20) notnull
firstname varchar(20) notnull
lastname varchar(20) notnull
i want sql query like
join the two tables and search data date wise.
my query is--------
select tU.UserID,tU.FirstName,tU.LastName,
tU.LastName+''+ tU.FirstName'UserId',
tA.UserID,tA.CreateDate,
tA.UpdateDate
from tAnalyst tA,
tUser tU
where tU.UserID=tA.UserID
and
tA.CreateDate = '7/25/2007'
in this query i haven't error but data is not display.
so pls guide me writeway.
regards
gayatri
Gayatri
|
|
|
|
|
1 . Gaytri it may possible that racords are not matche
2. Or Pass the Date as 07/25/2007 not 7/25/2007
Old tA.CreateDate = '7/25/2007' i think it is problem
New tA.CreateDate = '07/25/2007'
|
|
|
|
|
sir i am write query like you told me.
but its not working
gayatri
Gayatri
|
|
|
|
|
Ok then doing This way
convert(varchar,tA.CreateDate,101)='07/25/2007'
|
|
|
|