create procedure getdetails(@inputstring varchar(2)) as select * from returnrecords where substring(city,1,2)=@inputstring --since the input string is having varchar(2) as the data type i presume that u need to get all the records where the city name has first two letters as the city name.I thought that was your requirement
Declare @inputstring varchar(3) = '201' Select * From TableName Where PATINDEX('%,' + CAST(ColumnName AS VARCHAR(30))+',%', ',' +@inputstring + ',') > 0
alter proc returnmatchingrecords @inputstring varchar(2) as begin select * from returnrecords where city like '%'+ @inputstring+ '%' end
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)