Create Procedure Search In Sqlserver Using UNION ALL And Clause Like

Create Procedure Search In Sqlserver Using UNION ALL And Clause Like 

Example :
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[Getcari]
@idiklan nvarchar
,@judul nvarchar
,@nmkategori nvarchar
,@status nvarchar
,@harga nvarchar
,@deskripsi nvarchar
,@UserId nvarchar
AS
BEGIN
SET NOCOUNT ON;
SELECT * FROM tblproperti WHERE idiklan LIKE '%' + @idiklan + '%' OR judul LIKE '%' + @judul + '%' OR nmkategori LIKE '%' + @nmkategori + '%' OR status LIKE '%' + @status + '%' OR harga LIKE '%' + @harga + '%' OR deskripsi LIKE '%' + @deskripsi + '%' OR UserId LIKE '%' + @UserId + '%'
UNION ALL
SELECT * FROM tblother WHERE idiklan LIKE '%' + @idiklan + '%' OR judul LIKE '%' + @judul + '%' OR nmkategori LIKE '%' + @nmkategori + '%' OR status LIKE '%' + @status + '%' OR harga LIKE '%' + @harga + '%' OR deskripsi LIKE '%' + @deskripsi + '%' OR UserId LIKE '%' + @UserId + '%'
END
This Code Working My Computer

0 KOMENTAR