Questions tagged [datetime2]

A SQL Server type that defines a date that is combined with a time of day that is based on 24-hour clock. datetime2 can be considered as an extension of the existing datetime type that has a larger date range, a larger default fractional precision, and optional user-specified precision.

A SQL Server data type that define a date that is combined with a time of day that is based on a 24-hour clock. datetime2 can be considered as an extension of the existing datetime type that has a larger date range, a larger default fractional precision, and optional user-specified precision.

References and resources

155 questions
0
votes
0 answers

Convert datetime to binary data type SQL Server

I have a value 20 01 01 29 13 11 58 15 46 52 00 00 00 which got migrated to a SQL Server table of column type binary as 0x20010129131158154652000000. If we observe it is exact value just prefixed with 0x, which is fine. Now, when I am trying to…
0
votes
4 answers

Default Value for datetime2

What is the default value for datetime2? Edited: Sorry maybe I explain me wrong, I've tried to insert getDate() and it save me this value. I need to know what is the value in this field (red one) of my ssms
Mario Erro
  • 77
  • 1
  • 1
  • 7
0
votes
0 answers

Importing DateTime data to DateTimeOffset

Lets say I have a table called Test. Test has a Column called CreatedDate. This is the DateTimeOffset at the time of creation of the row. Test also has a Column called ExternalDate. This is an externally provided time through an API. What I require…
gti303
  • 65
  • 2
  • 6
0
votes
1 answer

How to convert '01/01/0001' to datetime2

I was trying to display a '01/01/0001' from sql if the value is null. But when I convert the value into datetime2, it says: Msg 517, Level 16, State 3, Line 18 Adding a value to a 'datetime2' column caused an overflow. this is what I tried: …
Kokombads
  • 450
  • 2
  • 9
  • 23
0
votes
2 answers

Converting a custom date string into SQL datetime2

I have to load a CSV file into a temp table in SQL server 2008. There is a column in the CSV file which contains a date string formatted like this 11/04/2017 at 08:24:52. How can I parse this string and insert it into a datetime2 column? The…
Anton Belev
  • 11,963
  • 22
  • 70
  • 111
0
votes
2 answers

How can I make my EF4 entities use the datetime2 type with SQL Server CE 3.5?

I would like to store DateTime values using the datetime2 type in SQL Server CE 3.5. If this is possible, how would I change my entity data model? I've tried editing it manually and Visual Studio refuses to show it in the designer afterwards.
Tom Robinson
  • 8,348
  • 9
  • 58
  • 102
0
votes
0 answers

SQL: datetime2 overflow in WHERE, but not in SELECT

I've seen plenty of threads about datetime2 overflows when hitting the minimum date, but I don't have that in my data. Additionally, the DATEADD works fine in the SELECT statement, but not in the WHERE statement. Here's what I'm trying to do: SELECT…
Matthew J Gravelyn
  • 441
  • 1
  • 4
  • 7
0
votes
2 answers

Is it possible to configure application for replace DateTime.MinValue to null?

I work on a big ASP.NET MVC application. This app contains many forms with date time controls. Values of this controls is optional. Also in database field where store values from this controls can be null. Date-time controls returns Min date…
user6408649
  • 1,227
  • 3
  • 16
  • 40
0
votes
1 answer

How do I Check for valid date in C# (that has a datetime type not datetime2)?

I've been searching but haven't found my answer so forgive me if this question is a duplicate. I've got a .Net C# application that is using entity framework (EF) to communicate with a SQL Server database. I'm converting a large amount of data and I…
0
votes
1 answer

Powerbuilder Datawindow + Datetime2 Error

I am in the process of Converting a large application to work against SQL Server 2014. It is currently running against Sybase ASE 15. The Problem is when I try to retrieve a value from a column that is defined as Datetime2, I get "Error: Invalid…
0
votes
3 answers

SQL Server: convert StartDATE 20140804 Nvarchar to Datetime2

I'm using SQL Server 2008 and I did an import from a flat file. I couldn't import the datetime column properly so I specified it temporarily as a nvarchar(50). Now I want to convert it to datetime2 format. However when doing so, I get the error…
user3052850
  • 178
  • 3
  • 17
0
votes
1 answer

MSSQL DateTime2 Fail to Update

Im running stored procedure which in charges to insert, update and delete table's entries. While both insert and delete runs smoothly, the update operation updates all columns except DATETIME2 one. The scenario - I test my Repository pattern (using…
Roi Shabtai
  • 2,981
  • 2
  • 31
  • 47
0
votes
2 answers

showing full date & time in datagridview

I am having an application that shows date and time in datagridview after exporting data from database to dataset. Details : I have a column called Date that contains date and time in datetime2 format and when showing date, seconds don't show…
Ahmed Aekbj
  • 91
  • 1
  • 12
0
votes
1 answer

How to select datetime2 from Windows forms DateTimePicker

I am trying to sort my database data in datagridview using DateTimePicker control , the type of date column in my Event_test table is datetime2 SqlDataAdapter sda = new SqlDataAdapter("SELECT * from Event_test where date between '" …
Ahmed Aekbj
  • 91
  • 1
  • 12
0
votes
1 answer

Is datetime2 support in MS SQL Server 2014 express

I'm a little confused on this. Microsoft seems to advocate the using of datatime2 instead of datetime. Datetime2 is smaller, and has better resolution and range, but when I go to design my database in SQL 2014 Express, datetime2 is not listed in…
James R
  • 145
  • 2
  • 13