Is there a MOD function for SqlServer's T-SQL?

Posted on 2005-04-06
Medium Priority
Last Modified: 2008-01-09

     I know Oracle uses a MOD function like Basic's to determine the remainder after a division.  So 20 MOD 9 = 2 (9 goes into 20 twice for a total of 18, 20 - 18 = 2).  I need to determine a remainer in a T-SQL function I'm writing for Sql Server.  But there doesn't seem to be a MOD operator, or maybe it's a certain character or another name for it - I haven't found it yet though.  Does anyone know of one?

Question by:gleznov
LVL 23

Accepted Solution

adathelad earned 500 total points
ID: 13717027
Yes, it's the % sign

SELECT 20 % 9

Expert Comment

ID: 13717065
set @a=10%3

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

612 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question