Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TSQL Date Format Query Syntax

Posted on 2011-03-10
4
Medium Priority
?
415 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
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 2000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

876 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