Solved

TSQL Date Format Query Syntax

Posted on 2011-03-10
4
391 Views
Last Modified: 2012-06-27


This I am sure its easy but I can find it online

I need to return a date with time as 0000 or no time

But I dont wat to use the convert because I dont what to make it a string

I like to keep it as a  date


This 2011-02-27 10:52:46.310

would return 2011-02-27 00:00:00.000
or 2011-02-27

what to keep as date not using convert


0
Comment
Question by:Leo Torres
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 

Expert Comment

by:bizbiz20032003
ID: 35096080
Function Date(xxxxx) ?
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 35096091
cast ( yourfield as date)
0
 
LVL 15

Accepted Solution

by:
derekkromm earned 500 total points
ID: 35096131
dateadd(day, 0, datediff(day, 0, '2011-02-27 10:52:46.310'))
0
 
LVL 8

Author Closing Comment

by:Leo Torres
ID: 35096228
thank you that was exactly what I am looking for
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question