Pages

SQL server date functions


To find current date and time : select SYSDATETIME();

To display only date : select convert(date,SYSDATETIME());

To display only time : select convert(time,SYSDATETIME());

Here is the query to display all this above.

select SYSDATETIME() as Timestamp,convert(date,SYSDATETIME()) as Date,CONVERT(time,SYSDATETIME()) as Time;

No comments:

Post a Comment

Featured post

Snowflake - Creating warehouse in Snowflake

Creating warehouse Login to Snowflake and click on warehouse and click on Create fill the necessary details and click Finish We can also c...