SQL - seraching for a real number in SQL database

I am looking for a store procedure that will help to search a real number for example 91.91

Any one know how to do it or any exisiting store procedure?

Thanks.
tommym121Asked:
Who is Participating?
 
Kyle AbrahamsConnect With a Mentor Senior .Net DeveloperCommented:
In that case do a between:

declare @min
declare @max


set @min = subtract tolerance from value

set @max = add tolerance to value

where @columnName between @min and @max
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
It's a select statement.


create procedure searchNum
@input  Real
as

select * from <table> where <col> = @input
0
 
awking00Commented:
Search in what? A column in a table, all columns in a table, all tables in a schema, all tables in a database?
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
tommym121Author Commented:
I am try to search in the database for such a number (real and money)
0
 
tommym121Author Commented:
0
 
Kyle AbrahamsSenior .Net DeveloperCommented:
Shows the framework of how to loop through the entire database.  

Just change the last exec statement to not bring back the Left part of the column.

and change the where to @ColumnName = @SearchStr2
0
 
tommym121Author Commented:
ged325,

Real number is approximate not precise,  I need to set a tolerance like  abs(@ColumnName - @SearchStr2)/@SearchStr2 < Tolerance to see if @ColumnName = @SearchStr2.  Tolerance can be 10E-6
0
 
tommym121Author Commented:
How do I put such a formula in SQL where statement?
0
 
tommym121Author Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.