TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
karthik parcha
NA
153
92.8k
HOw to write cases in SQLSERVER
Nov 11 2011 7:43 AM
HI this ismy issue please help me
Contract Signing Date + 1 year - 1 day.
(Example if the contract signed was on 2/3/2011 then it would be active through 2/2/2012.Then i have to show textmarketing status active otherwise if the contract is not in between the dates then inactive please help me
IF text marketing status is active i have to show expiration date
inactive i have to expiration date NULL
I have written alomost but not getting result
SIGNING_DATE <= EXPIRATION_DATE(
Explanation:FIrst i have updated the Expiration date column by siging date
UPDATE T
SET T.EXPIRATION_DATE=(DATEADD(DAY,-1,(DATEADD(YEAR,1,T.SIGNING_DATE))))//Contract Signing Date + 1 year - 1 day.
//Iam checking the condition with expiration can u plesae write in one single update statement if possible
UPDATE #TEMP_SB SET TEXT_MARKETING_STATUS =
(CASE
WHEN SIGNING_DATE <= EXPIRATION_DATE THEN 'ACTIVE'
ELSE 'INACTIVE'
END)
UPDATE #TEMP_SB set EXPIRATION_DATE=NULL WHERE TEXT_MARKETING_STATUS='INACTIVE'
SELECT * FROM #TEMP_SB
Reply
Answers (
2
)
To find out second highest salary in Sql Server
Cast And Convert in SQLServer