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.


DECLARE @VariableName DataType;

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

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


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

      RETURN ISNULL(@result,'')

No comments:

Post a Comment

Note: only a member of this blog may post a comment.