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.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Time

Author  Topic 

sven2
Yak Posting Veteran

57 Posts

Posted - 2010-11-04 : 08:15:46
Hello,

is it possible to store only a time in a table instead of datetime?

Best regards,
Sven

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-11-04 : 08:21:30
quote:
Originally posted by sven2

Hello,

is it possible to store only a time in a table instead of datetime?

Best regards,
Sven



Possible only if you use character datatypes such as char, varchar ,etc. But if you use datetime datatype, the datepart will be 1900-01-01

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sven2
Yak Posting Veteran

57 Posts

Posted - 2010-11-04 : 08:32:55
Yes, that is true, but if I import the data into MS office Word i don't want to see the date.

I tried everything in Word but I can't remove the date. So now I was thinking what if I can only store the time ...

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-11-04 : 08:39:24
When you import, just use convert function

select convert(varchar(10),datetime_col,108) from your_table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sven2
Yak Posting Veteran

57 Posts

Posted - 2010-11-04 : 08:47:53
Well, actually it is not an import, it is a merge ...

Go to Top of Page
   

- Advertisement -