pokemonjohn
Programmer
Hello.
I have a stored procedure that returns a recordset to an ASP page. What want to add is some error handling, as if people enter a character ( *, ^, % etc...) it causes an error. All i want to do is, if an error is caused it to return no results. so i could add an extra section of code which is only run when an error occurs but how do i get this to run. i have tried if @@error <> 0 but could not get it to work
this is my code so far.
CREATE PROCEDURE SP_ImagebankRes
(
@SchParam varchar(600),
@SchPict varchar(100)
)
AS
declare @sql varchar(1024) --local var for sql string
set @sql = 'SELECT [KEY],RANK,imageID,imagename, txtdescription,Metkeyword,
metsystamatic,MetSubjectArea,MetType,PictURL, PictFileURL
FROM CONTAINSTABLE(imagebankmeta1,*,'''+ @SchParam + ''') C
JOIN imagebankmeta1 P
ON P.imageID = C.[KEY]
where rank > 5
'+ @SchPict +'
ORDER BY RANK DESC'
exec(@sql)
GO
Thankyou for your help.
I have a stored procedure that returns a recordset to an ASP page. What want to add is some error handling, as if people enter a character ( *, ^, % etc...) it causes an error. All i want to do is, if an error is caused it to return no results. so i could add an extra section of code which is only run when an error occurs but how do i get this to run. i have tried if @@error <> 0 but could not get it to work
this is my code so far.
CREATE PROCEDURE SP_ImagebankRes
(
@SchParam varchar(600),
@SchPict varchar(100)
)
AS
declare @sql varchar(1024) --local var for sql string
set @sql = 'SELECT [KEY],RANK,imageID,imagename, txtdescription,Metkeyword,
metsystamatic,MetSubjectArea,MetType,PictURL, PictFileURL
FROM CONTAINSTABLE(imagebankmeta1,*,'''+ @SchParam + ''') C
JOIN imagebankmeta1 P
ON P.imageID = C.[KEY]
where rank > 5
'+ @SchPict +'
ORDER BY RANK DESC'
exec(@sql)
GO
Thankyou for your help.