Latest Post

Saturday, 24 September 2016

Declare Keyword in sql

Hello guys , I am sharing Declare  keyword with you.

Declare operator is used to Declare a variable and store data temporarily during the execution of code.

Syntax:-

DECLARE @VariableName DataType;

We can also declare more than one variable with comma separator as below

DECLARE @Variable1 DataType1, @Variable2 DataType2,....

Example:-

DECLARE @result VARCHAR(255)
      SET @result = (SELECT RegionName FROM Regions WHERE RegionId=@RegionId)

      RETURN ISNULL(@result,'')

Government Jobs