-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: datepart function for sql 2005
PostPosted: Wed Sep 02, 2009 2:10 pm 
Newbie

Joined: Wed Sep 02, 2009 2:01 pm
Posts: 1
We are upgrading from SQL Server 2000 to SQL Server 2005 and we use hibernate in our application.I am having issues with the datepart function
I have a hibernte property defined in the hbm file as
Code:
<property name="rateEffectiveYear" formula="datepart(yyyy,ASSN_DSGN_LST_MDFY_DT)" insert="false" update="false"/>

The query is
Code:
" from CustRequest cust left join fetch cust.opptys oppty "

which is generating this sql
Code:
select custreques0_.CUST_REQ_ID_NBR as CUST1_160_0_, opptys1_.OPTY_ID_NBR as OPTY1_162_1_, custreques0_.CORP_ENT_CD as CORP2_160_0_, custreques0_.CUST_NBR as CUST3_160_0_, custreques0_.BSTAR_ACCT_NBR as BSTAR4_160_0_, custreques0_.CUST_NM as CUST5_160_0_, custreques0_.RPTG_CUST_NM as RPTG6_160_0_, custreques0_.UNDRWRTG_SEG_CD as UNDRWRTG7_160_0_, custreques0_.SLS_REPV_NM as SLS8_160_0_, custreques0_.ACCT_EXCUTV_NM as ACCT9_160_0_, custreques0_.PRPSL_CRTE_DT as PRPSL10_160_0_, custreques0_.PRPSL_NBR as PRPSL11_160_0_, custreques0_.LST_MDFY_BY as LST12_160_0_, custreques0_.CRTE_BY as CRTE13_160_0_, custreques0_.LST_MDFY_DT as LST14_160_0_, custreques0_.CRTE_DT as CRTE15_160_0_, opptys1_.RTG_EVNT_ID_NBR as RTG2_162_1_, opptys1_.OPTY_DESC as OPTY3_162_1_, opptys1_.OPTY_DETL_DESC as OPTY4_162_1_, opptys1_.COVRG_CD as COVRG5_162_1_, opptys1_.STA_CD as STA6_162_1_, opptys1_.BLUPRNT_IND as BLUPRNT7_162_1_, opptys1_.CPY_ADJSTMT_DT as CPY8_162_1_, opptys1_.UNDRWRTG_CSTCTR as UNDRWRTG9_162_1_, opptys1_.EMPLE_ID_NBR as EMPLE10_162_1_, opptys1_.EXPRC_DATA_DT as EXPRC11_162_1_, opptys1_.FORMU_RT_DT as FORMU12_162_1_, opptys1_.VEND_CNT as VEND13_162_1_, opptys1_.DEDICATED_FSU_IND as DEDICATED14_162_1_, opptys1_.NON_STD_GUAR_IND as NON15_162_1_, opptys1_.SECT_DETL_IND as SECT16_162_1_, opptys1_.AUD_FEE_TYP as AUD17_162_1_, opptys1_.AUD_FEE as AUD18_162_1_, opptys1_.MCARE_OPT_IND as MCARE19_162_1_, opptys1_.RTG_SYS_VRSN_MAJ_NBR as RTG20_162_1_, opptys1_.RTG_SYS_VRSN_MNR_NBR as RTG21_162_1_, opptys1_.SNGL_FAM_TIER_IND as SNGL22_162_1_, opptys1_.ADMNSTV_FEE_OPT_TYP as ADMNSTV23_162_1_, opptys1_.LST_MDFY_DT as LST24_162_1_, opptys1_.LST_MDFY_BY as LST25_162_1_, opptys1_.CRTE_DT as CRTE26_162_1_, opptys1_.CRTE_BY as CRTE27_162_1_, opptys1_.ASSN_DSGN_LST_MDFY_DT as ASSN28_162_1_, opptys1_.RTG_SYS_VRSN_DT as RTG29_162_1_, opptys1_.VIR_ASSN_DSGN_LST_MDFY_DT as VIR30_162_1_, opptys1_.RTG_CORP_ENT_CD as RTG31_162_1_, opptys1_.RTG_UNDRWRTG_SEG as RTG32_162_1_, opptys1_.RUNOUT_FEE_BAS_MO_CLM_LIAB as RUNOUT33_162_1_, opptys1_.RUNOUT_FEE_BAS_MO_FX_CST as RUNOUT34_162_1_, opptys1_.BUS_TYP as BUS35_162_1_, opptys1_.RTG_METH_OPT_TYP as RTG36_162_1_, opptys1_.PAR_PLN_PRCG_IND as PAR37_162_1_, opptys1_.DNTL_MED_CENSUS_IND as DNTL38_162_1_, opptys1_.FINCL_GUAR_IND as FINCL39_162_1_, opptys1_.IPPA_VRSN_NBR as IPPA40_162_1_, opptys1_.DISC_GUAR_IND as DISC41_162_1_, opptys1_.TRND_GUAR_IND as TRND42_162_1_, opptys1_.INWK_GUAR_IND as INWK43_162_1_, opptys1_.EXPCT_DISC as EXPCT44_162_1_, opptys1_.EXPCT_INWK_UTIL as EXPCT45_162_1_, opptys1_.CUST_REQ_ID_NBR as CUST46_162_1_, [b][color=#FF0000]datepart(opptys1_.yyyy,opptys1_.ASSN_DSGN_LST_MDFY_DT[/color])[/b] as formula0_1_, opptys1_.CUST_REQ_ID_NBR as CUST46_0__, opptys1_.OPTY_ID_NBR as OPTY1_0__ from LG_CUST_REQ custreques0_ left outer join LG_OPTY opptys1_ on custreques0_.CUST_REQ_ID_NBR=opptys1_.CUST_REQ_ID_NBR


and getting the following error
Code:
Caused by: java.sql.SQLException: [IBM][SQLServer JDBC Driver][SQLServer]'opptys1_.yyyy' is not a recognized datepart option.

Did anybody encounter the same problem.?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.