Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
darvelo
Starting Member
9 Posts |
Posted - 2006-07-20 : 10:55:25
|
| I have a VB.NET program that displays the time extracted from a SQL Server database datetime datatype by way of a User-defined scalar function I created. However, sometimes information is entered into the system through the program that does not have a time-- only a date. SQL Server automatically assigns a time of 12:00 AM to these values (since they're a datetime). Is there any way to detect when this happens in my user-defined scalar function so that when I try to extract time values, I can instead return a message/time of my choice? I would rather not assume that all 12:00 AM values are automatically inserted by SQL Server since this might not actually be the case. |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-07-20 : 11:16:22
|
| Nope - the datetime willl be saved as an integer value - the integer part being the number of days from 1 jan 1900 - the time is held in the decimal part of the value.No way of telling that this is due to no time being saved.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
darvelo
Starting Member
9 Posts |
Posted - 2006-07-20 : 11:29:49
|
| Aww.. all right. Thanks for the quick reply, MVP :) |
 |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-07-20 : 12:26:51
|
quote: Originally posted by darvelo Aww.. all right. Thanks for the quick reply, MVP :)
It's better to make sure your applications put the data into the database correctly, instead of trying to figure out why it is wrong on the back end.CODO ERGO SUM |
 |
|
|
darvelo
Starting Member
9 Posts |
Posted - 2006-07-20 : 14:28:21
|
Oh, it's actually an interface for people, who are really the underlying source of any problem like this when it comes down to it. |
 |
|
|
|
|
|