.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

How to get current date, day and year in sql server?

Posted By: Ramesh P     Posted Date: October 30, 2010    Points:2   Category :Sql Server
How to get current date, day and year in sql server?

Responses
Author: Syed Shakeer Hussain             
Posted Date: October 30, 2010     Points: 5   

Hi,

Run the below Query to Get Day,Month and Year

SELECT YEAR(GETDATE()) as "Year";

SELECT MONTH(GETDATE()) as "Month";

SELECT DAY(GETDATE()) as "Day";


Author: ASPEvil             
Posted Date: November 08, 2010     Points: 5   

To get the date, use the following:-
-------------------------------------
select getdate()


To get the day, use the following:-
------------------------------------
select day(getdate())


To get the year, use the following:-
-------------------------------------
select year(getdate())

Author: sriram             
Posted Date: October 27, 2011     Points: 20   

select getdate()
select day(getdate()) as "day"
select year(getdate()) as "year"

regards
Sriram.R



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend