表包含许多在BirthDate列中具有Hijri日期值和Gregorian值的记录,因此请如何通过将Hijri日期转换为Gregorian的值来更新Birthdate 谢谢 我尝试过这个脚本,但它不起作用 - 我的意思是没有变化 - 虽然我得到了
UPDATE MEMBER
SET BIRTHDATE = case when (SUBSTRING(cast(birthdate as nvarchar), 1, 2) ='14')
or
(SUBSTRING(cast(birthdate as nvarchar), 1, 2) ='13')
then
(SELECT CONVERT(date, birthdate , 131) )
else
birthdate
end
答案 0 :(得分:0)
尝试下面的代码,它会将birthdate列记录转换为Hijri格式:
更新会员 设置BIRTHDATE = CONVERT(VARCHAR(100),birthdate,131)--- [Hijri date to Gregorian date]
更新会员 设置BIRTHDATE = CONVERT(datetime,birthdate,131)--- [公历日期到Hijri日期]
有几篇关于此的博客,请注意:http://blogs.msdn.com/b/wael/archive/2007/04/29/sql-server-hijri-hijra-dates.aspx