Microsoft
Software
Hardware
Network
Question : sql if else syntax
I have a siple statement no idea where I am errig.
DECLARE @R-Day int
DECLARE @StartDate
SET @R-Day int=15
DECLARE @MR-Day int
SET @MR-Day = DAY(GETDATE()) -- GETS TODAY'S DATE EXAMPLE 1,2,...31
IF @MR-Day i= 15 ---If it its 15th of the month
@StartDate='1999-01-01 00:00:00'
ELSE
@StartDate ='2008-02-02 00:00:00'
i AM ASSUMING EVERYTHING IS CORRECT. but cannot copile the above.
Basically what I need to do is find today's day (1.....31) . If 15th of moth set a different satrt date.
Any help would be greatly appreciated.
Thanks
YRKS
9GETdATE())
Code Snippet:
1:
x
Open in New Window
Select All
Answer : sql if else syntax
SELECT @StartDate = CASE DAY(GETDATE()) WHEN 15 THEN '1999-01-01 00:00:00'
ELSE '2008-02-02 00:00:00'
END
Random Solutions
CONVERT(char(10),[DATE_FIE<wbr />LD], 110) Question
SBS 2003 service pack will not install
Exchange 2003 Standard Upgrade To Enterprise Still Dismounting Information Store
Roxio installed on Dell laptop - won't un-install or run
Using VBA to check if a network drive is available
Importing records from external table gives duplicate records.
Routing and Remote Access on Windows SBS 2003 - Troubleshooting failed VPN connections
From an MS Access Form how do I open a web site then automaticly fill in the login and password box from data in my table?
Multiple MX IPs, SMTP connectors on one Exchange server
SQL to Insert