Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# SQL-Server
I have a small application in C# for data's read from Excel and then store the datas to Sql Server 2008. In Excel there is a column for Hijri_Date like dd/MM/yyyy format,
Example: 17/4/1432
I need to read from Excel and update it to SQl Server 2008. For that in sql server what datatype has to declare for this? either DateTime or datetime2 ?
And what will be the update statement?
Update MyTable set My_Hijri_Dt=?? where MyField1='MyValue';
Does anybody can give the details?
Thanks BY
Posted 13-Nov-12 3:29am
Edited 13-Nov-12 3:35am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I'm not 100% certain about this, but according to this[^] SQL server only supports Greogrian Dates. This makes some sense as al-Hijri is one of the few calendars that doesn't follow the solar year and the difficulty where lunar observations are applied. You can change a UTC date to a Hijri on using the cast/convert[^] functions if you want, but it's probably better to store do everything on the SQL server side in UTC, and write a function to convert to al-Hijri on the client.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 9,935
1 OriginalGriff 6,987
2 CPallini 5,845
3 George Jonsson 4,015
4 Gihan Liyanage 3,266

Advertise | Privacy | Mobile
Web02 | 2.8.140926.1 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100