dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: SQL Server
Expertise: Beginner
Jun 25, 1998

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Arithmetic functions in SQL

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

Answer:
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.
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date