/*
In case our matching parameter is integer means following query will return exact match records top and then remaining topics
*/
DECLARE @temp table(id int, name varchar(50))
insert into @temp(id, name)
values(1, 'Dharmesh,Singh'),
(2, 'Rohan,Singh'),
(3, 'Alok,Singh'),
(13, 'Amit,Visvakarma'),
(21, 'Bipin, Singh')
DECLARE @temval varchar(30)
SET @temval = 2
Select id, name from @temp where id like '%' + @temval + '%'
order by LEN(id)In this code snippet, I will explain how to use sql server to show exact match values at the top and then partial match values with example or sql server show exact match values at first and then show partial match.
