How to debug a stored procedure in ssmsVideo: https://www.youtube.com/watch?v=AlRNA8pmfIk
This is the stored:
USE [InfoMateDbDev]
GO
CREATE PROCEDURE [dbo].[spProducts]
@SearchInTag nvarchar(50) = null
AS
BEGIN
-- Insert statements for procedure here
IF(@SearchInTag IS NULL OR @SearchInTag = '')
select * from shr.Products order by CodeRow
ELSE
select * from shr.Products where SearchTags LIKE '%' + @SearchInTag + '%' order by CodeRow
END
GO
This is the query for debug the stored procedure:
--New query on ssms
DECLARE @SearchInTag varchar(50)
SET @SearchInTag = 'ASK_Schrader_Clamp-in_Gen'
EXECUTE spProducts @SearchInTag
PRINT 'Done'
-- The video is at: https://www.youtube.com/watch?v=AlRNA8pmfIk