1
vote
2answers
132 views

Converting a varchar date into a date (dd/mm/yy)

I have a CSV file that has dates written like this: 250909,240909 and they get stored in a SQL Server database as varchars. How do I get it to convert them into dates so that it gets displayed like ...
3
votes
1answer
56 views

Should I change my old datetime columns from SQL Server 2005 to just date datatype for SQL Server 2012

My database was developed in 2005 for SQL Server 2005 version. In that time for columns which store pure date without time we used datetime data type. Our database has survived up today and now we ...
1
vote
1answer
2k views

Understanding datetime formats in SQL Server

I've dealt with MS SQL Server datetime types for a long time but never thought why the following is happening: I query a table that contains a smalldatetime column. This smalldatetime is always ...
2
votes
1answer
67 views

DATETIME2FROMPARTS alternatives for SQL Server 2008

I am trying to part a datetime value and build it together removing minutes, seconds and so on. I want the values to be hourly. Usually this works on a SQL Server 2012 machine: DATETIME2FROMPARTS( ...
2
votes
1answer
407 views

Setting DATEFIRST to 6

I would like to set FIRSTDATE to 6 (ie: saturday), i have read that to change it parmanently i could set the default language of the login to one of an existing language from the sys.syslanguages and ...
0
votes
1answer
90 views

UTC date in DMV dm_broker_queue_monitors

It seems that the DMV dm_broker_queue_monitors returns UTC time rather than local time. Why is it so? I am wondering how to get local time from this view? I can get current time offset, but that is ...
0
votes
2answers
393 views

Convert datetime to europe default without time

I have a datetime field that I need to convert into the format DDMONYY (27Aug12). I am currently using convert(nvarchar(30),DateToConvert,13), but that also spits out the time. How can I easily ...
2
votes
3answers
1k views

SQL Server dates - can I get date and hour?

In SQL Server, can I do the equivalent of to_char(date_field, 'YYYY-MM-DD:HH24') in Oracle to get 2012-01-30:23?
8
votes
3answers
3k views

Storing date as integer (numeric), what are the advantages

Question 1 I am working with a system where date is stored as integer (actual numeric(8,0)) and I have noticed that other systems also store date as int such as cisco in this thread. Example ...