Solved

Mathematical functions in T-SQL

Posted on 2002-07-28
1
1,182 Views
Last Modified: 2011-10-03
How do I find a list of mathematical functions in SQL?

I would like to find the equivalent of the modulo function (Mod) in VB.

E.g. to look for houses with an even number, the following SQL statement works fine with Access databases:

SELECT * FROM Place WHERE (((Place.house_no) Mod 2)=0);

How do I do this in SQL Server?
0
Comment
Question by:MTecho
1 Comment
 
LVL 9

Accepted Solution

by:
miron earned 50 total points
ID: 7184490
did you try

SELECT * FROM Place WHERE Place.house_no % 2=0;

I think sql server uses modulo operator that looks like a percent sign
---
%
---

To find complete list of mathematical functions and operators try look up On-Line documentation under
"Transact-SQL Reference->Operators"
and
"Transact-SQL Reference->Functions"


Cheers
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

759 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now