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 |
|
jeffm
Starting Member
1 Post |
Posted - 2002-03-22 : 11:44:42
|
| Is there any way to insert only the time into a datetime field thru asp? Example follows:INSERT INTO Blah (bTime) VALUES ('9:30:00 AM')This insert statement puts this into the field: 1/1/1900 9:30:00 AM and all I want in the field is 9:30:00 AM.Is this possible?Thanks |
|
|
JamesT
Yak Posting Veteran
97 Posts |
Posted - 2002-03-22 : 11:49:51
|
| No way to avoid the 1/1/1900 part however when retrieving the values you can choose just the time by converting it. Try this:select convert(varchar(10), GetDate(),108) |
 |
|
|
yakoo
Constraint Violating Yak Guru
312 Posts |
Posted - 2002-03-22 : 11:50:12
|
| I dont believe so.If you dont specify the date SQL will automatically use the default date of 1/1/1900. You will most likely need to use the DatePart function if you just want the time information retrieved from the DB.If you are going to be doing queries you can query based on DatePart. You might even be able to do queries based on just time. Im not sure if SQL will append 1/1/1900 to that as well. |
 |
|
|
leeholden
Starting Member
34 Posts |
Posted - 2002-03-22 : 11:52:47
|
| No is the short answer. But if you want to store it in a datetime field you can do the following to return just the time:select convert(varchar,btime,114) as btimefrom blah |
 |
|
|
yakoo
Constraint Violating Yak Guru
312 Posts |
Posted - 2002-03-22 : 11:53:14
|
| we need to have a snipping image.I think someone before mentioned a bullseye image, or a cross hair image would be good. |
 |
|
|
|
|
|