Friday, March 23, 2012
Noob count question
date.
I want to write a stored procedure that returns the next 4 events starting
from today, so far I have:
SELECT
[EventID],
[EventName],
[EventDate]
FROM
Events
WHERE
(DATEDIFF(dd, GETDATE(), EventDate) > 0)
ORDER BY
[EventDate] ASC
How do I add a clause to say only return a maximum of 4 (or however many is
left if fewer) events from today?Use the TOP clause using 4 as the number of records to be returned.
Optionally SET ROWCOUNT. But TOP is preferred.
HTH
Jerry
"Seefor" <invalid@.email.address> wrote in message
news:DfBXe.111419$G8.92946@.text.news.blueyonder.co.uk...
>I have a table of events, which stores an event ID, event Name and event
>date.
> I want to write a stored procedure that returns the next 4 events starting
> from today, so far I have:
> SELECT
> [EventID],
> [EventName],
> [EventDate]
> FROM
> Events
> WHERE
> (DATEDIFF(dd, GETDATE(), EventDate) > 0)
> ORDER BY
> [EventDate] ASC
>
> How do I add a clause to say only return a maximum of 4 (or however many
> is left if fewer) events from today?
>|||many thanks
"Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
news:etg0fRTvFHA.1392@.tk2msftngp13.phx.gbl...
> Use the TOP clause using 4 as the number of records to be returned.
> Optionally SET ROWCOUNT. But TOP is preferred.
> HTH
> Jerry
> "Seefor" <invalid@.email.address> wrote in message
> news:DfBXe.111419$G8.92946@.text.news.blueyonder.co.uk...
>|||If you want to use an index on EventDate efficiently, make sure you don't
have any manipulation on the filtered column.
Instead of:
WHERE (DATEDIFF(dd, GETDATE(), EventDate) > 0)
Use:
WHERE EventDate >= CONVERT(VARCHAR(8), GETDATE(), 112)
Specify TOP 4 in the SELECT list, and sort by EventDate .
BG, SQL Server MVP
www.SolidQualityLearning.com
"Seefor" <invalid@.email.address> wrote in message
news:DfBXe.111419$G8.92946@.text.news.blueyonder.co.uk...
>I have a table of events, which stores an event ID, event Name and event
>date.
> I want to write a stored procedure that returns the next 4 events starting
> from today, so far I have:
> SELECT
> [EventID],
> [EventName],
> [EventDate]
> FROM
> Events
> WHERE
> (DATEDIFF(dd, GETDATE(), EventDate) > 0)
> ORDER BY
> [EventDate] ASC
>
> How do I add a clause to say only return a maximum of 4 (or however many
> is left if fewer) events from today?
>
Wednesday, March 21, 2012
Nonfatal Errors after Adding WindowsNT Event Log as Logging Provider
How do you keep the non-fatal error dialog box from coming up after you enable logging and specify the Windows NT Event Log as the log provider? I know the problem is that the "configuration" for a log provider is expected to have some value and none is needed for the Windows NT Event Log, but the message box is annoying when it comes up.
I could probably hack the XML for the package, but I have a customer who wants to add the Windows NT Event Log as a provider to a lot of packages, so hacking the XML for each package after adding the logging options doesn't sound like a great idea.
Anyone?
Thanks,
Dave Fackler
Hi Dave,
this was a problem with CTP15 and has been addressed since then. I'm afraid you'll have to wait until the next CTP is available.
regards,
ashsql
Wednesday, March 7, 2012
Nofications assemblies not found with .net 2.0
Hi guys,
I was trying to develop a non hosted event provider and decided to use NS event object api to submit events to NS. My development system has VS 2005 and my plan is to connect to a NS instance running on a machine on the local network.
But it is weird that I could not find "Microsoft.SqlServer.NotificationServices.dll" in my dev system. Does it mean to develop NS applications we need to have VS 2005 and Sql Server 2005 on same box.
Also note that I have sql server express edition on my development machine and I am aware that express editions doesn't support notification services.
Thanks,
Shamir
Hi Ahmed -You need to install the SQL Server 2005 Notification Services Client
Components on the development machines.
http://www.microsoft.com/downloads/details.aspx?FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&DisplayLang=en
Only Standard and Enterprise Editions support SSNS.
http://www.microsoft.com/sql/prodinfo/sysreqs/default.mspx
HTH...
Joe
--
Joe Webb
SQL Server MVP
http://www.sqlns.com
~~~
Get up to speed quickly with SQLNS
http://www.amazon.com/exec/obidos/tg/detail/-/0972688811
I support PASS, the Professional Association for SQL Server.
(www.sqlpass.org)
On Sun, 23 Jul 2006 02:47:01 -0700,
wrote:
>Hi guys,
>
>I was trying to develop a non hosted event provider and decided to use
>NS event object api to submit events to NS. My development system has VS
>2005 and my plan is to connect to a NS instance running on a machine on
>the local network.
>
>But it is weird that I could not find
>"Microsoft.SqlServer.NotificationServices.dll" in my dev system. Does it
>mean to develop NS applications we need to have VS 2005 and Sql Server
>2005 on same box.
>
>Also note that I have sql server express edition on my development
>machine and I am aware that express editions doesn't support
>notification services.
>
>Thanks,
>
>Shamir
>
>|||
[Reposting since my prior post didn't seem to render very well.]
Hi Ahmed -
You need to install the SQL Server 2005 Notification Services Client
Components on the development machines.
http://www.microsoft.com/downloads/details.aspx?FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&DisplayLang=en
Only Standard and Enterprise Editions support SSNS.
http://www.microsoft.com/sql/prodinfo/sysreqs/default.mspx
HTH...
Joe
--
Joe Webb
SQL Server MVP
http://www.sqlns.com
~~~
Get up to speed quickly with SQLNS
http://www.amazon.com/exec/obidos/tg/detail/-/0972688811
I support PASS, the Professional Association for SQL Server.
(www.sqlpass.org)