Tag: datetime

How to use NOT IN or Not Exist custom in Datetime?

i use 2 table, i want first table not data in table two of show on to database. Ex. *First Table “filesTA”* EmpNo | ChkDate 00001 | 2012-10-01 00:00:00.000 00001 | 2012-10-02 00:00:00.000 00001 | 2012-10-03 00:00:00.000 00001 | 2012-10-04 00:00:00.000 00001 | 2012-10-05 00:00:00.000 “SalaryDay2” sEmpNo | sDate 00001 | 2012-10-01 00:00:00.000 00001 | […]

Sum a date range inside another date range

Trying to write a query in SQL for the following: an event has a start/end date/time. Users are available for certain times. How can I find the total time a user is available for a particular event? Example: –Event– eventID eventStart eventEnd 1 2012-10-10 15:00 2012-10-10 18:00 –Available– userID availStart availEnd 64 2012-10-10 10:00 2012-10-10 […]

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. […]

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