IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[fn_GetSolarDate]') AND type = 'FN')
DROP FUNCTION [dbo].[fn_GetSolarDate]
GO


CREATE function [dbo].[fn_GetSolarDate](@day nvarchar(50),@isZh_CN int = 1)      
returns datetime
as      
begin
declare @dt datetime 
set @day = SUBSTRING(@day,1,10)
if(@isZh_CN=1)
select @dt= 公历 from ebs_kernel.dbo.pub_solarlunarmap where 农历数字=@day
else 
select @dt= 公历 from ebs_kernel.dbo.pub_solarlunarmap where 农历中文=@day

return @dt 
end