IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'spScheduleRoomPopulate')
BEGIN
DROP Procedure spScheduleRoomPopulate
END
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
CREATE PROCEDURE [dbo].[spScheduleRoomPopulate]
@RoomID int
AS
SET NOCOUNT ON
--ALTER TABLE ScheduleRoom NOCHECK CONSTRAINT ALL
DELETE FROM ScheduleRoom
--ALTER TABLE ScheduleRoom CHECK CONSTRAINT ALL
SET IDENTITY_INSERT ScheduleRoom ON
INSERT INTO ScheduleRoom
(
ScheduleRoomID
,ScheduleCenterID
,ScheduleRuleCode
)
SELECT
AssessmentCenterRoomID
,AssessmentCenterID
,'STANDARD ALL WEEK'
FROM AssessmentCenterRoom
SELECT CASE
WHEN @RoomID <> 0 THEN
WHERE AssessmentCenterRoomID=@RoomID
END
SET IDENTITY_INSERT ScheduleRoom OFF
|