Welcome to MSSQL Forum!
MSSQL Forum - Discussions about Microsoft SQL Server

You are currently viewing our community forums as a guest user. Sign up or
Having an account grants you additional privileges, such as creating and participating in discussions.

create field for date

Discussion in 'General' started by Heidibb, Jan 3, 2013.

  1. Heidibb

    Heidibb New Member

    Hello,
    I have a field in a table that includes date and time stamp :

    2012-07-03 07:00:25.0

    I would like to keep this field, but would like to update the table and add another field that is ONLY the date. Not quite sure how to do that.

    Thoughts?

    Thanks in advance
  2. Peter Schmitz

    Peter Schmitz Administrator Staff Member

    Hello and welcome to the forum,

    I would suggest using a computed column, using the following formula:

    Code (TSQL):

    CONVERT(VARCHAR(10),<your date column>,111)
     
    You would replace <your date column> with the name of your actual date/time column.

    Let me know if that works out for you?

    Peter

Share This Page