The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
1answer
102 views

How to find number of days since beginning of fiscal month?

This relates to my question How to find XXth day of previous month in SQL server? The fiscal month starts on 26th of each month. I need to find out from any date: The date of the start of the ...
0
votes
1answer
23 views

Date format on the output of cmdshell dir C:\ /TC

I would like to ask you guys if anyone of you had this trouble before. In SQL I read the create time of the file like exec master.dbo.xp_cmdshell 'dir C:\ /TC' which gives me; 07/14/2009 04:20 ...
0
votes
1answer
81 views

Whether to use or not to use: DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

In one Database table, created_at & updated_at are defined as: `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP `updated_at` timestamp NOT NULL DEFAULT ...
0
votes
0answers
16 views

Date Range Limit SQL [duplicate]

I am trying to create a report that calculates how many contracts have been funded each month for the year 2014. The problem is I am trying to limit the dates, meaning I want the user to be able to ...
2
votes
2answers
114 views

Datetime column vs Date + Time columns

I am designing a table for a system that saves a number of logs. We are looking at ~200 entries per second. We are using SQL-Server 2012 Enterprise Edition. I have a question regarding breaking up a ...
0
votes
1answer
50 views

selecting records that are 3 days from expiring datetime

I have a table that contains a datetime timestamp. What I am looking for is to select records that are exactly 3 days from the 30 day expiration based on the datetime timestamp. Here is what I have ...
-1
votes
1answer
68 views

how to update date field in a record to null?

I have records in a table which a field named as 'validity' contains date as '8/15/1947 12:00:00 AM'. I need to set this date as null. I am having 1000 records,in that validity field is '8/15/1947 ...
4
votes
1answer
165 views

date formatting in Oracle

this query: select to_char(sysdate, 'Ddspth MONTH, Yyyysp') from dual will return: Eighteenth MARCH , Two Thousand Fourteen i am wondering if there are any additional formatting keywords that ...
0
votes
2answers
72 views

compare dates in results

I'm looking to compare the dates in the result set Example: SELECT * FROM tbl WHERE foo=bar Output id, datetime, name 1, 2014-01-01 18:13:45, test 1 2, 2014-01-01 19:01:32, test 2 3, 2014-01-01 ...
1
vote
2answers
294 views

Datediff() in MySQL

While calculating difference between 2 dates as number days, by using MySQL Datediff() function, I am facing some issue, the SQL code is given below. select datediff((select curdate()), (select ...
0
votes
0answers
252 views

Firebird-Time Interval- between 2 Dates

I try to select the period of employment for the members in a Company. Example: Date of join: 01.01.2001 Today: 27.02.2014 Now, I want this: 13 years, 1 month and 27 days I have a Statement which ...
0
votes
2answers
105 views

Primary key for link/junction table with time-dependent data

I want to link two tables in such a way that for any given time period the relationship is one-to-one, but over time the relationship can change. As an minimal example, suppose I want to list the ...
1
vote
1answer
225 views

SSIS: Get Date for Day of the Week

In SSIS, how do I get the date for a specific day of the week? For example, how do I get last Sunday's date? I assume I have to do some subtraction on the day-of-week, but not sure: DATEADD("d", ...
1
vote
2answers
74 views

How to use a column's latest date in query?

SELECT smart_allusers_karen.lastlogin, smart_allusers_karen.supemail, smart_allusers_karen.regionname FROM smart_allusers_karen WHERE lastlogin < MAX(smart_allusers_karen.lastlogin) - INTERVAL 30 ...
1
vote
2answers
528 views

how to change the default date format in oracle

New to Oracle here, i am working on some assigments but i noticed when i was creating the tables using a script, oracle throws the following error: ORA-01858: a non-numeric character was found where ...
0
votes
1answer
230 views

Get max date for each year from list of dates

Need to get max date for each year from list of arbitrary dates: date year ================= 1/10/2013 2013 3/26/2013 2013 4/20/2012 2012 9/10/2012 2012 5/6/2011 2011 So ...
6
votes
2answers
6k views

How to combine date and time to datetime2 in SQL Server?

Given the following components DECLARE @D DATE = '2013-10-13' DECLARE @T TIME(7) = '23:59:59.9999999' What is the best way of combining them to produce a DATETIME2(7) result with value '2013-10-13 ...