Re: Passing DateDiff rather than Actual Dates as Parameters



laurenq uantrell (laurenquantrell@xxxxxxxxxxx) writes:
> I've gotten sort of fed up with dealing with regional date settings on
> the client side and am considering the following scheme - just
> wondering if anyone has a negative view of it or not:
>
> Instead of
>
> @StartDate datetime,
> @EndDate datetime
>
> Use:
>
> @StartDaysDiff int,
> @EndDaysDiff int
>
>
> In the front end app take the desired date and do a DATEDIFF with the
> current date, then pass the date diff as a parameter as an integer
> rather than deal with the dates at all.

You could run into nasty surprises if the client and server are in
different time zones. Then again, if you instead of using the current
date as your base date, took a fixed date such as 1900-01-01, you'd be safe.
Then again, this is also confusing as 1900-01-01 is the base date in SQL
Server while in Visual Basic it's 1899-12-30.

And I don't really see how this relieves you from dealing with regional
settings on the client side. After all, the user inputs a date, and the
interpretation of 1/7/9 is different depending on where you are. And
to transform that to a number, you still have to interpret it.

--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: Slow Networking
    ... W2k Pro client connect fine, ... clients have about a 15-20 second delay. ... >>Do your NIC settings match those of the switch port you ... >>SQL server, make sure are not starving it for memory. ...
    (microsoft.public.windows.server.networking)
  • SOLUTION: Problem connecting to sql server
    ... it is an account problem. ... Not associated with a trusted SQL Server ... go to Client Configuation properties on the client machine ... >> settings on the SQL server, ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
    ... I think it will ameliorate the situation if you clean up the client as ... And to come back to my problem: I think with help of the SQL Server admins ... closed connections - but all of these errors are in the version which used ... Every new client opens again 30 connections if I open 30 tables ...
    (microsoft.public.sqlserver.connect)
  • Re: Best way to populate webpages from multiple tables
    ... tables within hash tables, custom classes etc. ... > Set a session expiring cookie at the client that stores the Customer ID. ... > send it to the client, instead store it in your session mgmt sql server - ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Best way to populate webpages from multiple tables
    ... tables within hash tables, custom classes etc. ... > Set a session expiring cookie at the client that stores the Customer ID. ... > send it to the client, instead store it in your session mgmt sql server - ...
    (microsoft.public.dotnet.framework.adonet)