Sunday, August 31, 2014

How to use DATEPART() in SQL ?

For SQL Server:

SELECT [ID],[RollNo],[Name],[Address],[Telephone],AdmissionDate]
FROM [dbo].[Students]

where 
(DATEPART(DAY,AdmissionDate)= '31' ) and DATEPART(MONTH,AdmissionDate)= '08' and DATEPART(YEAR,AdmissionDate)= '2014' 

order by ID desc

No comments:

Post a Comment

Secure you Asp .NET by Web.config & Global.ascx?

Add to Global.ascx protected void Application_BeginRequest(object sender,EventArgs e)     {         //to remove x frame         Resp...