below is the stored procedure
ALTER PROCEDURE [dbo].[stp_APDB_PersonStatusByPersonID]
-- Add the parameters for the stored procedure here
@PersonID int
AS
declare @sql nvarchar(max)
declare @params nvarchar(max)
declare @Status nvarchar(12)
set @sql = ''
set @params = ''
set @sql = N'select [Status] from vw_PersonUnit where PersonID = @PersonID'
set @params = N'@PersonID int'
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for procedure here
EXEC @Status = sp_executesql @sql,@params,
@PersonID = @PersonID;
print @sql
return @Status
END
|