Store Date/Time in SQL Server 2005

  • Thread starter Thread starter shahoo
  • Start date Start date
S

shahoo

Hi, I know this is not a good place for this post, but I have too.
I need to store Hijri Date in SQL Server 2005, but because it is year
1386 in Hijri calendar, SQL Server does not let me do that. I can
store it as simple text but it is not a good approach.
Can anyone help me please?
 
What do you mean by "SQL Server does not let me do that"?

Can't you just execute the following statement,

insert into whatever_table( whatever_date_field ) values( cast( '01/01/1386'
as datetime ) )

?
 
shahoo said:
Hi, I know this is not a good place for this post, but I have too.
I need to store Hijri Date in SQL Server 2005, but because it is year
1386 in Hijri calendar, SQL Server does not let me do that. I can
store it as simple text but it is not a good approach.
Can anyone help me please?

You're really, *really* going to have better luck asking the question
on a SQL Server newsgroup.
Try any of the groups in the microsoft.public.sqlserver hierarchy.

Michael
 
What do you mean by "SQL Server does not let me do that"?

Can't you just execute the following statement,

insert into whatever_table( whatever_date_field ) values( cast( '01/01/1386'
as datetime ) )

?

Nope. The range of SQL Server's datetime datatype is January 1, 1753,
through December 31, 9999. (1753 was the year the Gregorian calendar
was widely adopted).

Michael
 
You're really, *really* going to have better luck asking the question
on a SQL Server newsgroup.
Try any of the groups in the microsoft.public.sqlserver hierarchy.

Michael

OK I will. Thanks for the help.
 
Just a thought; store it in what the db (and indeed, .NET etc) is
happy with (i.e. Gregorian), but translate it at the presentation tier
through different validation / formatting.

At the end of the day, in the database it is only a number (well, set
of bytes of you take it too literally) - it only represents (say) a
Gregorian vs Hijri date/time value when you add context.

Marc
 
Back
Top