How to use sql getdate()?

In SQL statements, the GETDATE() function is used to obtain the current system date and time.

The method of use is as follows:

SELECT GETDATE();

This will return the current system date and time, for example: 2021-08-16 15:30:00.000.

You can also use the GETDATE() function in combination with an INSERT statement to insert the current date and time into a column in a table, for example:

INSERT INTO table_name (column_name) VALUES (GETDATE());
Leave a Reply 0

Your email address will not be published. Required fields are marked *