Click here to Skip to main content
15,893,663 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
DECLARE @dtReportingPeriod DATETIME
 SELECT @dtReportingPeriod =CAST(CAST(DATEPART(MM, ReportingPeriod)-1 AS VARCHAR(4)) + '/' +  CAST(DATEPART(DD, ReportingPeriod) AS VARCHAR(4)) + '/' + 
  CAST(DATEPART(YYYY, ReportingPeriod) AS VARCHAR(4)) AS DATETIME) 
 FROM Sector WHERE SectorID = @intFromSectorID AND InActive = 0 

please find above code and in that i wanted to check 3 conditions:
1)normal reporting period
2)based on condition decrement -1
3)reporting period is equal
Posted
v3
Comments
Nelek 2-Sep-13 7:25am    
This is not how CP usually works. Most important goal here is to learn and help learning.
You are supposed to try it on your own, and come here when you got stuck with something, with a concrete question about your code, design, etc.
Don't forget people here don't get payed. And besides, if we give you a ready-to-go solution, it is not going to help you because you are not going to learn anything from it.

Since you didn't ask any question, it is difficult to give you a better answer.

I strongly recommend you to read:
How to ask a question[^] and What have you tried?[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900