Sunday , December 22 2024

Assign the data on the same line when defining a variable with “Declare”.

 

In SQL Server 2008, when you define a variable with “Declare”, you can also assign data to that variable in the same row! We could not do this in earlier versions of SQL Server. However, after defining the variable, we were able to assign data to the variable using the “SET” command on another line.

So how do we do this in SQL Server 2008?

For example:

Loading

About Ekrem Önsoy

The original article was written in Turkish by Ekrem Önsoy and translated to English by dbtut with the consent of the author. The copyright of the article belongs to the author. The author shall not be liable in any way for any defect caused by translation.

Leave a Reply

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