Tag: datetime

How to default the time for the date with SQL Server

Does anyone know how can I default the time for the date with SQL Server? Example: When I use getdate() and it will return me the current date and time. How can I get the current date but default the time portion to ’10:00:00.000′ ?

Sum the Attendance Hours by Category and then Group by 'Week of'

I need to sum the attendance hours by category and then group by ‘Week of’. The ‘Week of’ start date is defined by the Monday in that week but Sunday is works too. If the Category Values are in ’Art’ or ‘PE’, they need to be combined into Non Educational. I also need to be […]

SQL Query to format output

I have a element of my SQL Query which is outputting a date, Query Element CONVERT(DATETIME, CONVERT(CHAR(8), UPOST, 100)) AS UPDATED Output 2013-05-03 00:00:00.000 What I need to do is get rid of the zeros and change the format so that it reads like this; 03-05-2013 Can anyone suggest a way to do this

converting start date to datetime as beginning of the day and end date to end of the day

Store PROCEDURE –para– @StartingDate DateTime = NULL, @EndingDate DateTime = NULL –condition — dbo.callentry.CallDateTime BETWEEN ISNULL(@StartingDate, dbo.callentry.CallDateTime) and ISNULL(@EndingDate,dbo.callentry.CallDateTime) Question : when i pass date ‘2012-09-17’ from date picker as para @StartingDate, and the same as ending date . it is comparing 2012-09-17 00:00:00.000 to 2012-09-17 00:00:00.000 – will return no records what i want […]

Search By Date in SQL Server 2012

We just upgraded to SQL Server 2012 from 2005. While I’m a novice, something this simple couldn’t be this difficult. I used to be able to pull data from a table based on the date vs date and time. As it now stands I have: Select * from receipts_table where receipt_cancel_date = ‘2013-09-20’ before we […]

Get nth weekday from XDate in SQL Server

I have to get date repeatedly for every N months. I have XDate to Start from. I want the nth week’s mth weekday’s date. N is say 2 – I have to get for every 2 month XDate is suppose tomorrow’s date. So, Starting from tomorrow m is 7 – So, get date of every […]

SQL Server date format handling

I am running the SAME Delphi 2007 code on two different Windows 7 machines and accessing the SAME SQL server database on a remote server. On one machine a date in the database is read in the format 2013-01-25 00:00:00.000 which causes the application to crash when it tries to convert this date to a […]

Sql server not Accepting Date from text box

I am not able to insert date from text box which is in DD/MM/YYYY format. I am using Visual Studio 2008 on Windows 7. my language and regional settings are “ENGLISH(United Kingdom)”, and my system is showing today’s date like 12/12/2013. The same date i have get in text box via form On load event. […]

Set 24 hours TimeInterval in Where Clause of SQL server

I need to query a table in an sql server, in which the Query results to be filtered between yesterday’s 5:00Pm to Today’s 5:00PM. But the Table contains Date and Time in seperate fields. Any help would be appreciated. Thanks

How to Combine a query with a AVG query when using datetime SQL 2008 R2

I am trying to combine two query’s together but I’m having trouble as it is a datetime column. right now I have a query that finds all the users + there slowest and fastest “Segment” time but I also need to find the avg segment time below are the two query’s I am using right […]

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