Click here to Skip to main content
12,456,128 members (51,744 online)
Rate this:
 
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
PARAMU
Posted 13-Nov-12 3:29am
Updated 13-Nov-12 3:35am
v2

1 solution

Rate this: bad
 
good
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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160826.1 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2016
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