[Solved] SQL Server 2008 R2 stored procedures


Try passing null value for unused parameters and inside the stored procedure put a check for nulls to switch tables.

CREATE PROCEDURE [dbo].[proc_search_patient_ByID]
( 
@PatID_pk int ,
@Cntid  smallint,
@FamID int
)
AS
SET NOCOUNT ON
IF @Cntid IS NULL
BEGIN
   --Use select stmt of a table
END
ELSE
   --Use select stmt of another table
BEGIN
END

Likewise switch tables with appropriate parameters.

0

solved SQL Server 2008 R2 stored procedures