|
From: rajdaksha on 3 Jul 2008 06:00 Hi Guys Any one please help me below query what is the meaning. IIF(RTL_SML_CONTRACT.TERM_DT=0 Or RTL_SML_CONTRACT.BOOKING_DT=0, 0, CDate(Mid$(RTL_SML_CONTRACT.TERM_DT,5,2) & "/"& Right$(RTL_SML_CONTRACT.TERM_DT,2) & "/" & Left$(RTL_SML_CONTRACT.TERM_DT,4))-CDate(Mid$ (RTL_SML_CONTRACT.BOOKING_DT,5,2) & "/" & Right$(RTL_SML_CONTRACT.BOOKING_DT,2) & "/" & Left$(RTL_SML_CONTRACT.BOOKING_DT,4)))<=365 thanks Raj
From: Roy Harvey (SQL Server MVP) on 3 Jul 2008 06:47 This is Microsoft SQL Server group. That isn't any sort of SQL Server code that I recognize, looks more like VB. The IFF expression starts by returning zero if either of two items are zero. Otherwise it strings together two dates out of who knows what and subtracts one from the other. The result of the IIF is then compared to 365. Roy Harvey Beacon Falls, CT On Thu, 3 Jul 2008 03:00:51 -0700 (PDT), rajdaksha(a)gmail.com wrote: >Hi Guys > >Any one please help me below query what is the meaning. > >IIF(RTL_SML_CONTRACT.TERM_DT=0 Or RTL_SML_CONTRACT.BOOKING_DT=0, 0, >CDate(Mid$(RTL_SML_CONTRACT.TERM_DT,5,2) >& "/"& >Right$(RTL_SML_CONTRACT.TERM_DT,2) >& "/" & Left$(RTL_SML_CONTRACT.TERM_DT,4))-CDate(Mid$ >(RTL_SML_CONTRACT.BOOKING_DT,5,2) >& "/" & >Right$(RTL_SML_CONTRACT.BOOKING_DT,2) >& "/" & >Left$(RTL_SML_CONTRACT.BOOKING_DT,4)))<=365 > >thanks >Raj
From: ML on 3 Jul 2008 06:48 Is this from Access? Consider also posting this in microsoft.public.access. As far as I can see you haven't posted the entire code, but anyway, here's an explanation: IIF(RTL_SML_CONTRACT.TERM_DT=0 Or RTL_SML_CONTRACT.BOOKING_DT=0, 0, CDate(Mid$(RTL_SML_CONTRACT.TERM_DT,5,2) & "/"& Right$(RTL_SML_CONTRACT.TERM_DT,2) & "/" & Left$(RTL_SML_CONTRACT.TERM_DT,4))-CDate(Mid$ (RTL_SML_CONTRACT.BOOKING_DT,5,2) & "/" & Right$(RTL_SML_CONTRACT.BOOKING_DT,2) & "/" & Left$(RTL_SML_CONTRACT.BOOKING_DT,4)))<=365 If and only if RTL_SML_CONTRACT.TERM_DT=0 or RTL_SML_CONTRACT.BOOKING_DT=0 return 0 else return the difference between RTL_SML_CONTRACT.TERM_DT and RTL_SML_CONTRACT.BOOKING_DT ....which is followed by another test ("<=365") which is why I think you've not posted the entire definition. But to understand the business logic behind this expression you should ask the author - we can only guess what it means. ML --- Matija Lah, SQL Server MVP http://milambda.blogspot.com/
From: Gert-Jan Strik on 4 Jul 2008 14:15 Raj, Please note that this code fragment is imply some Visual Basic or VBScript and has not direct relation with SQL. The expression will evaluate to TRUE if: - TERM_DT is 0 or - BOOKING_DT is 0 or - TERM_DT is within a year from BOOKING_DT -- Gert-Jan SQL Server MVP rajdaksha(a)gmail.com wrote: > > Hi Guys > > Any one please help me below query what is the meaning. > > IIF(RTL_SML_CONTRACT.TERM_DT=0 Or RTL_SML_CONTRACT.BOOKING_DT=0, 0, > CDate(Mid$(RTL_SML_CONTRACT.TERM_DT,5,2) > & "/"& > Right$(RTL_SML_CONTRACT.TERM_DT,2) > & "/" & Left$(RTL_SML_CONTRACT.TERM_DT,4))-CDate(Mid$ > (RTL_SML_CONTRACT.BOOKING_DT,5,2) > & "/" & > Right$(RTL_SML_CONTRACT.BOOKING_DT,2) > & "/" & > Left$(RTL_SML_CONTRACT.BOOKING_DT,4)))<=365 > > thanks > Raj
|
Pages: 1 Prev: Listing tables in a database Next: Identify table/index scans using SQL Server Profiler |