can't find the date style format in sql server 2012

Ariox66

I want to convert this nvarchar column to Datetime format:

        "29/12/14 07:46:20 PM"

This style is good but has no time:

        SELECT CONVERT(datetime, nvarcharDateColumn, 3) AS [DD/MM/YY]

How can i convert it and keep all the date parts (date+time) ??

Dan Guzman

A datetime data type in SQL Server has no "format". It is natively a 8-byte binary value. To convert the nvarchar string to datetime, use CONVERT with the nvarchar column as the second parameter:

SELECT CONVERT(datetime, nvarcharColumnWithDateAndTime, 3) AS NativeDateTime
FROM dbo.YourTable;

Note the datetime format displayed by this query is determined by the application your are using, not the SQL Server database. Also, consider changing the table data type to datetime to avoid data integrity issues; nvarchar will allow storing invalid dates.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

SQL Server 2012 Date Change

From Dev

Can't use MIN, MAX etc. SQL Server 2012

From Dev

Can't create column store index on SQL Server 2012

From Dev

Can't Connect to DelphiXE5 AND SQL SERVER 2012

From Dev

Can't attach database to SQL Server 2012 reason not found .log

From Dev

SQL Server 2012 Can't create any table

From Dev

Can't find firewall settings for SQL Server

From Dev

Can't find firewall settings for SQL Server

From Dev

how can we change the date format of SQL Server(2008) Database?

From Dev

How can I convert this query result to date format (SQL Server)

From Dev

In SQL Server can I format the way the date is presented?

From Dev

Setting hh:mm to 24 hours format in one single t-sql Query - SQL Server 2012

From Dev

How to find the difference between two date cells of different rows in sql server 2012?

From Dev

Date conversion issue in SQL Server 2012

From Dev

Sorting by Date of type String in SQL Server 2012

From Dev

PIVOT the date column in SQL Server 2012

From Dev

SQL Server 2012 - date not sort as expected

From Dev

Date format issue SQL Server

From Dev

Date Time Format in SQL Server

From Dev

SQL Server - Change Date Format

From Dev

Converting SQL server date format

From Dev

change the date format in sql server

From Dev

Date format in sql server 2008

From Dev

Twig, format date SQL Server

From Dev

SQL Server - Change Date Format

From Dev

Converting SQL server date format

From Dev

Custom Date format in Sql Server

From Dev

Convert SQL Server Date Format

From Dev

How to find a reference key in SQL Server 2012?