Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Rita Bhatnagar
Posting Yak Master
172 Posts |
Posted - 2001-05-16 : 12:10:46
|
| lstrSQL = lstrSQL & " WHERE a.CostMasterScheduleSessionId = b.CostMasterScheduleSessionIdIf alngCareRecipientId <> 0 ThenlstrSQL = lstrSQL & " AND c.CareRecipientId = " & alngCareRecipientIdEnd IfIf adatePeriod <> 0 ThenlstrSQL = lstrSQL & " AND e.StartDateTime >= CvDate('" & Format(adatePeriod, "mm/01/yyyy") & "')"lstrSQL = lstrSQL & " AND e.StartDateTime < CvDate('" & Format(DateAdd("m", 1, adatePeriod), "mm/01/yyyy") & "')"End IfThis is the code in VB .I changed this in stored procedure like this.......@period datetime \*this is adateperiod*ASDeclare @period2 datetimeset @Period2=DateAdd(m, 1, @period)..........WHERE a.CostMasterScheduleSessionId = b.CostMasterScheduleSessionId AND (c.CareRecipientId =@prmCareRecipientID or @prmCareRecipientID<=0)AND ( @period = 0 or e.StartDateTime between dateadd(day,-day(@period)+1,@period) and dateadd(day,-day(@period2),@period2))I am confused at the part @period=0.Is this right or not.Thanks for any help. |
|
|
|
|
|