Tag: datetime

Time difference between two times in the same table

(Please note that I have seen a similar question on StackOverflow recently, however I can not find it anywhere – if anyone can find it please post the link) I have a table that has a datetime field in it. For example: Table data DateTime date; int number; I need to find the difference between […]

How to change mm/dd/yyyy to desired format

I have date in format mm/dd/yy.For eg:4/1/2009 means April 1 2009.I want to get format as April 1,2009 in sql.Can anybody help?

SQL server datetime column filter on certain date or range of dates

There is an example for today here Get row where datetime column = today – SQL server noob I am primarily interested in 2008 only. For today it looked like SELECT (list of fields) FROM dbo.YourTable WHERE dateValue BETWEEN CAST(GETDATE() AS DATE) AND DATEADD(DAY, 1, CAST(GETDATE() AS DATE)) What literal value of date(s) or functions […]

How to filter a table by T_SQL in SQL Server 2005, using a specific time for a column of “DateTime” datatype

How to filter a table by T_SQL in SQL Server 2005, using a specific time for a column of “DateTime” datatype? Thank you

How do I combine data from two DateTime columns (SQL Server)?

Using SQL Server 2005, I am working with a database which has two columns to keep track of what is essentially a single DateTime (and I can’t for the life of my figure out why anyone would ever think this is a good idea). Basically, one column, let’s call it OrderDate, contains a DateTime like […]

Return a Table of Payroll Dates from a SQL Stored Procedure

I’m working with SQL Server Reporting Services 2008, which is somewhat new to me, as most of my experience is with LAMP development. In addition, moving most of the logic to SQL as stored procedures is something I’m not very familiar with, but would like to do. Any help or direction would be greatly appreciated. […]

Setting SQL datetime to minimum using C# DateTime

I have a datetime column in SQL Server. I believe the minimum it can be is some date in 1753 or something. My Entity Framework POCO representing the table contains a DateTime. I’d like to set the datetime in the database to the minimum it can be set to. What’s the easiest way to do […]

How do I find data from this day exactly one year ago?

Right now I have: year(epe_curremploymentdate) = year(DATEADD(year, -1, SYSDATETIME())) But that is giving me everything from last year. All I want is the data from today’s date, one year ago.

Getting the current date in SQL Server?

This question already has an answer here: How do I get just the date when using MSSQL GetDate()? [duplicate] 7 answers

Get only the Date part of DateTime in mssql

Possible Duplicate: Get just the Date from grouping in select from DateTime column in SQL Server How can I get only the Date part of a DateTime ? I’m searching for something like year() function but for the whole date.

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.