SQL Server SIGN() function syntax and example for integers
In this tutorial, we are going to learn SIGN() function syntax and usage in the sql server. When we are going to write some case statement in the sql server we may require SIGN function. In the below example SQL Query, i am showing how to use SIGN function for the integer values. This is one of the good SQL Server Interview Questions.SIGN function return:
positive values : 1
negative values :-1
zero value : 0
Output:
SQL Server SIGN() function for integers |
declare @positive int, @negative int,@zerovalue int set @positive=2; set @negative=-2; set @zerovalue=0; select SIGN(@positive) positive,SIGN(@negative) negative,SIGN(@zerovalue) zerovalue
Post a Comment
Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.