Arithmetic functions in SQL

Arithmetic functions in SQL

How do you create or access arithmetic functions like INT, MOD, or SQRT for use in Microsoft SQL Server?

SQL Server supports math functions including SQRT, CEIL, FLOOR, and ROUND. As far as MOD goes, SQL Server supports the use of % instead of a MOD function. For example,

SELECT 3 % 2

results in 1.

When it comes to creating other functions that you can call from SQL Server, there are a couple of options:

  • You could create the function manually in a stored procedure using SQL.
  • You could create a DLL in VB or any other language that takes the two numbers and returns the remainder, and call it using the OLE automation stored procedures.
  • You could create an extended stored procedure in C++ and register it in SQL Server.

Hope this helps.

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular