SIGN functions in SQL Server

This article will show you in detail how to use SIGN () function to handle SQL Server with syntax and specific examples to make it easier to visualize and capture functions.

Describe

The SIGN function in SQL Server is used to retrieve the sign of a number or the transmitted expression.

The function will return one of the following:

  1. If number> 0, SIGN returns 1
  2. If number = 0, SIGN returns 0
  3. If number <0, SIGN returns -1

Syntax

To use the SIGN function in SQL Server, we use the following syntax:

 SIGN(number) 

Parameters :

  1. number: number passed to get the mark

Note :

  1. SIGN function can be used in later versions of SQL Server: SQL Server 2017, SQL Server 2016, SQL Server 2014, SQL Server 2012, SQL Server 2008 R2, SQL Server 2008, and SQL Server 2005.

For example

See and explore some examples of SIGN functions in SQL Server.

 SELECT SIGN(-23); 
Result: -1

SELECT SIGN(-0.1);
Result: -1

SELECT SIGN(0);
Result: 0

SELECT SIGN(0.1);
Result: 1

SELECT SIGN(14);
Result: 1

SELECT SIGN(2019-2014);
Result: 1

Previous article: ROUND function in SQL Server

Next article: SUM function in SQL Server

4 ★ | 1 Vote

May be interested

  • Apple officially locked iOS 11.3 signApple officially locked iOS 11.3 sign
    today apple has been the key to sign ios 11.3, after a week of launching ios 11.3.1. this means that users cannot undo the old operating system version after they have uploaded to ios 11.3.
  • The difference between web server and app serverThe difference between web server and app server
    you have probably seen that the terms web server and app server are often used interchangeably as if they are related to the same thing and also facilitate the website to function properly. but in reality, they are not the same.
  • How to Sign Out of Windows 10How to Sign Out of Windows 10
    do you want to sign out of windows 10, but can't seem to find the option to do so? signing out of windows does not shut down your computer and lets you sign in to another user account. scroll down to the first step to get started. *before...
  • ABS function in SQL ServerABS function in SQL Server
    this article will show you in detail how to use the abs () handling function in sql server with specific syntax and examples to better visualize and capture functions.
  • Using the 'Sign In With Google' option is risky and there is currently no workaroundUsing the 'Sign In With Google' option is risky and there is currently no workaround
    researchers have found that using this feature as an employee of a business can put you at risk of having your privacy violated, and worse, there's no fix yet.
  • Summary of trigonometric functions in ExcelSummary of trigonometric functions in Excel
    radians trigonometric functions, degrees, cos, ... in excel will help users to calculate quickly, compared to manual methods.
  • How to insert a signature into PDF on MacHow to insert a signature into PDF on Mac
    you can create signatures and use it to sign very simple documents on a mac. no need to download new applications, no need for online services.
  • Network basics: Part 3 - DNS ServerNetwork basics: Part 3 - DNS Server
    a dns server is a server that contains a database of public ip addresses and hostnames associated with them. in most cases, the dns server is used to resolve or translate those common names into ip addresses as required.
  • How to fix 'We can't sign into your account' error on Windows 10How to fix 'We can't sign into your account' error on Windows 10
    some windows 10 insider build 20226 users have reported that they were unable to log in to user profile (s) as expected. microsoft now offers a solution for help with this problem.
  • FLOOR function in SQL ServerFLOOR function in SQL Server
    the floor function in sql server returns the largest integer value but less than or equal to the transmitted numeric expression.