Joseph Gagliardo
Member since Dec 11, 2008
- Profile: /members/559-joseph-gagliardo.htm
- Comments: 6
Recent Blog Comments By Joseph Gagliardo
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Sep 25, 2007 at 8:55 PM
I cannot remember all the details off the top of my head, and I am not near a SQL Server at the moment. But I remember there being a bunch of requirements to make a function deterministic. I think it had to be schema bound, and there were a few environment settings that had to be a certain way, like... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Sep 21, 2007 at 6:22 PM
I don't mean to be argumentative, I just want to share with everyone something that I found to be one of the most difficult problems I've ever had to solve in SQL Server. Determinism is basically a property that says a function will always return the exact same value for a given set of parameters. I... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Sep 21, 2007 at 10:14 AM
These methods may be more elegant or perform faster but my original formula of subtracting the hours minutes and seconds is still the only one that will result in a deterministic function that can be used to create a calculated column which is indexable. I cannot conceive of a situation where you wo... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Jan 4, 2007 at 6:10 PM
Sorry I have not been following this thread for a while. Somehow when I posted the source code of the UDF the stars disappeared. It is supposed to be -1 * in there, but as the subsequent comment shows a plain minus sign works well also. In any event, this is the only form of a date correction functi... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Oct 20, 2006 at 6:36 PM
Not sure what your problem is. I use that date format all the time. If you convert(datetime, colname) it will return a datetime as long as the data you supply it is proper. Of course, if you are supplying the number as an integer, it will not return the result you expect. You must pass it as string ... read more »
-
Getting Only the Date Part of a Date/Time Stamp in SQL Server
Posted on Oct 4, 2006 at 3:27 PM
OK these methods are all fine, but there is one overlooked problem. I wrote a function called DateOnly that encapsulates this time stripping functionality so I don't have to do it over and over. The other nice thing about a function is it can be used to add a calculated column to a table so you ca... read more »