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
 Transact-SQL (2005)
 Date Question

Author  Topic 

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2008-12-04 : 01:10:31
hi all,

how do we manage dates before year 1753 ?
for example date like 03-Nov-1526


tanx in advance.....

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-04 : 01:23:34
It depends on what you will do with the dates later, how you will use them.
If they are for presentation issues only, leave them as varchar.
If you want to search and things, store them as three separate columns; yyyy, mm and dd.

Or install SQL Server 2008 which can handle dates back to year 1.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2008-12-04 : 01:26:34
ok tanx peso..
but is there any problems using dates column as varchar for those particular dates?

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-04 : 01:28:34
It depends on what you will do with the dates later, how you will use them.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2008-12-04 : 01:35:52
ok
so we can't convert this varchar date column to datetime for using other datefunctions.
am i right ?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-12-04 : 01:37:33
Yes you are right.
You will have to build your own DATEDIFF/DATEADD functions. Or install SQL Server 2008.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

soorajtnpki
Posting Yak Master

231 Posts

Posted - 2008-12-04 : 01:44:37
ok
very thanks peso
Go to Top of Page

jholovacs
Posting Yak Master

163 Posts

Posted - 2008-12-04 : 10:09:20
You could make your own data type, to include a unix-style epoch. That would also imply making your own datetime functions too though, which could get ugly, quick.



SELECT TOP 1
w.[name]
FROM
dbo.women w
INNER JOIN
dbo.inlaws i
ON
i.inlaw_id = w.parent_id
WHERE
i.net_worth > 10000000
AND
i.status IN ('dead', 'dying')
AND
w.husband_id IS NULL
ORDER BY
w.hotness_factor DESC
Go to Top of Page
   

- Advertisement -