Solved

SQL - seraching for a real number in SQL database

Posted on 2012-03-14
10
251 Views
Last Modified: 2012-08-13
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.
0
Comment
Question by:tommym121
  • 5
  • 4
10 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 37720126
It's a select statement.


create procedure searchNum
@input  Real
as

select * from <table> where <col> = @input
0
 
LVL 32

Expert Comment

by:awking00
ID: 37720471
Search in what? A column in a table, all columns in a table, all tables in a schema, all tables in a database?
0
 

Author Comment

by:tommym121
ID: 37721176
I am try to search in the database for such a number (real and money)
0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 37721216
0
 

Author Comment

by:tommym121
ID: 37722761
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 37724930
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
 

Author Comment

by:tommym121
ID: 37742225
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
 

Author Comment

by:tommym121
ID: 37742231
How do I put such a formula in SQL where statement?
0
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 37743215
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
 

Author Closing Comment

by:tommym121
ID: 37745731
Thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
I have a large data set and a SSIS package. How can I load this file in multi threading?
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.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

930 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

10 Experts available now in Live!

Get 1:1 Help Now