In SQL Server 2012, set the time default value to "Current Time"

Source: Internet
Author: User

Recently, you need to set the default value for DateTime to the current time in SQL Server 2012.

Set through a visual window instead of writing the GETDATE () function in an SQL statement, or writing ' 2022-2-2 22:22:22 ' in an SQL statement.

At first, there are articles written on the Internet, but more is written in the SQL statement, then the format of the default is some problem, has failed.

Correct illustrations: (GETDATE ())

In fact, it is a visualization, in the SQL statement spelling getdate () can be OK, in the Visual window is OK.

It is so simple, but then the brain is disabled, must add single quotation marks what a mess, the ignition, lesson bar ~

In SQL Server 2012, set the time default value to "Current Time"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.