Solved

TSQL Date Format Query Syntax

Posted on 2011-03-10
4
348 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
Comment Utility
Function Date(xxxxx) ?
0
 
LVL 142

Expert Comment

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

Accepted Solution

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

Author Closing Comment

by:Leo Torres
Comment Utility
thank you that was exactly what I am looking for
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
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…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now