Search with stored procedure

2

Good morning classmates I have a stored procedure to search by code and it works fine but I would like to know if there is a way that by searching for example the 1.5 in addition to looking for those with the 1.5 also drag the record with code 1 and if it is put 2.1 to drag the record 2, and if you search for cods also find them in the same way.

codp   cods
1      rxx
2      rxx    
1.5    r01              
1.5    r01
1.6    r02      
2.1    r23      
2.1    r23          
2.1    r23


create procedure buscar
@codp float
as begin
set nocount on
select * from codigos
where @codp=codp
end
    
asked by Raul.Sen 05.07.2017 в 15:24
source

1 answer

2

According to your comment, what you can do is the following:

SELECT *
FROM codigos
WHERE codp = @codp 
OR codp = FLOOR(@codp);
    
answered by 05.07.2017 / 15:44
source