hi all,
how to split and set the empty values in sql server using stored procedure like
@serchtext='city,sate'
how to split city ,sate separate my out put like:
@city=city
@state=state
my query like this
ALTER PROCEDURE [dbo].[SP_TESTSEARCH](@Mode int,@INDUSTRY varchar(100),@JOB_TYPE varchar(100),@SERCHTEXT VARCHAR(100))
AS
BEGIN
Declare @city varchar(100);
Declare @sta varchar(100);
SET @city= SUBSTRING(@LOCATION,0,CHARINDEX(',',@LOCATION,0))
Set @sta= SUBSTRING(@LOCATION,(CHARINDEX(',',@LOCATION,0)+1),(lEN(@LOCATION)-(CHARINDEX(',',@LOCATION,0))))
if(@sta is null)
begin
set @sta=''
end
if(@city is null)
begin
set @city=''
end
how to write a query for split and set null or empty the values for declare
variables am search like in:
exec SP_TESTSEARCH 2,'','','city'
i didn't get any error but display the all records.
am exec the procedure like this:
exec SP_TESTSEARCH 2,'','','city,'''
i got the matching records
how to set empty values in SP
thanking you