SQL SERVER – Adding Datetime and Time Values Using Variables


Datetime datatype stores date and time part. If you have only date value, You can add time part to a datetime variable using direct literal value and + operator. It is shown below DECLARE @date DATETIME SET @date=’2010-10-01′ SET @date=@date+’15:00:00′ SELECT @date AS DATETIME The result is 2010-10-01 15:00:00.000 But it is not possible to…

Source: SQL SERVER – Adding Datetime and Time Values Using Variables

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s