Using getdate() to provide only short date

Posted on 2007-08-09
Last Modified: 2012-06-21
Hello, how can I use the getdate() function to only provide a short date like 12/31/2007 on an update statement?

I was thinking something like this would work but it is not...
update test
set modifieddate = getdate(convert, 101)
Question by:gogetsome
    LVL 8

    Accepted Solution

    convert(varchar(10), getdate(), 101) will give you a date in short format
    LVL 6

    Expert Comment

    update test
    set modifieddate = cast(convert(varchar(10),getdate(),101) as DateTime)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Introduced in Microsoft SQL Server 2005, the Copy Database Wizard ( is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
    Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
    Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
    Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

    779 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

    11 Experts available now in Live!

    Get 1:1 Help Now