[dba-SQLServer] DateTime Hell!

Billy Pang tuxedo_man at hotmail.com
Thu Oct 2 11:32:53 CDT 2003


hmmm... not sure what the issue you are trying to describe is but I'll give 
it a shot...

1) is the parameter you are trying to pass in a datetime variable or text?
2) how are you comparing your dates?
3) when you pass in the date, try using the 101 format (ie. 
convert(smalldatetime, '10/02/2003',101))

Billy


>From: "Selina Iddon" <selina at easydatabases.com.au>
>Reply-To: dba-sqlserver at databaseadvisors.com
>To: <dba-sqlserver at databaseadvisors.com>
>Subject: [dba-SQLServer] DateTime Hell!
>Date: Thu, 2 Oct 2003 22:14:00 +1000
>
>Hi Everyone
>I haven't participated in this list too much because I'm relatively new to
>SQL and with the help of Susan's book and reading this list have been
>struggling through, but this one has me at my wits end.
>
>I am passing a parameter to a stored procedure and using this ID it
>retrievies the datetime from a view and is assigned to a variable.  I then
>want to assess whether the times overlaps with other datetimes in the same
>view.  The stored procedure is converting the date format to 2003-10-03
>14:00:00.000 when putting it in the variable and my view has the date time
>formatted as 3 Oct 2003 2:00:00 PM and they won't compare to each other,
>even though they are both happily inside convert(datetime,XXX) functions 
>and
>have come from the same field in the same view.  I've tried using
>convert(datetime,XXX,13) replacing the 13 with 6, 9 and multiple other
>combinations as described on a web site I found, but nothing works.
>
>Please Please help if you can.  I've lost days on this project which is due
>Monday (in my dreams!)
>
>TIA
>Selina
>
>
>_______________________________________________
>dba-SQLServer mailing list
>dba-SQLServer at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>http://www.databaseadvisors.com
>

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus



More information about the dba-SQLServer mailing list