C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Tips » General »

SQL Query to print day name text


Posted Date: 31 Oct 2009    Resource Type: Tips    Category: General
Author: RaamkumarMember Level: Silver    
Rating: 1 out of 5Points: 3



In my project I need to display day Of the Week. This following code snippet demonstrates the SQL query to print day text.

The following code snippet uses arithmetic operators uses custom Operation it will be fast.


select day = case DATEPART(dw,getdate())
When '1' then 'Sunday'
When '2' then 'Monday'
When '3' then 'Tuesday'
When '4' then 'Wednesday'
when '5' then 'Thursday'
When '6' then 'Friday'
When '7' then 'Saturday'
end ,DayId =case DATEPART(dw,getdate())
When '1' then '7'
When '2' then '1'
When '3' then '2'
When '4' then '3'
when '5' then '4'
When '6' then '5'
When '7' then '6'
end



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
SQL query to print the day name  .  SQL QUERY For Get Custom Day of the Week  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Adsense Tips
Previous Resource: Dos command
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use