tsql Coverting date

Posted on 2011-10-18
Last Modified: 2012-06-27
Hi Experts

I have a datetime output in SQL 2005 I am converting this to a string value and want to output as yyyy-mm-dd
If I use
select (convert(nvarchar(50),getdate(),120))
it returns the datevalue I want but also includes the time, is there a way I can just get the date without using the left command

Question by:MrDavidThorn
    LVL 39

    Accepted Solution

    select (convert(varchar(10),getdate(),120))
    LVL 39

    Expert Comment

    by:Pratima Pharande
    select (convert(nvarchar(10),getdate(),120))

    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

    by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
    Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    728 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

    21 Experts available now in Live!

    Get 1:1 Help Now