SQL Now () function

Source: Internet
Author: User

Now () function

The NOW function returns the current date and time.

Tip: If you are using a SQL Server database, use the GETDATE () function to get the current DateTime.

SQL Now () syntax
SELECT now () from table_name
SQL Now () instance

We have the following "Products" table:

prod_id ProductName Unit UnitPrice
1 Gold + G 32.35
2 Silver + G 11.56
3 Copper + G 6.85

Now, we want to show the name and price of the day's date.

We use the following SQL statement:

SELECT ProductName, UnitPrice, now () as Perdate from products

The result set looks like this:

ProductName UnitPrice perdate
Gold 32.35 12/29/2008 11:36:05 AM
Silver 11.56 12/29/2008 11:36:05 AM
Copper 6.85 12/29/2008 11:36:05 AM

SQL Now () function

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.