Untitled

mail@pastecode.io avatar
unknown
sqlserver
14 days ago
743 B
10
Indexable
Never
USE [MuOnline]
GO

SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO
ALTER Procedure [dbo].[WZ_CS_ModifyCastleOwnerInfo]

	@iMapSvrGroup		SMALLINT,
	@iCastleOccupied	INT,
	@szOwnGuildName	VARCHAR(8)
AS
BEGIN
	BEGIN TRANSACTION
	
	SET NOCOUNT ON

	IF EXISTS ( SELECT MAP_SVR_GROUP FROM MuCastle_DATA  WITH (READUNCOMMITTED) 
				WHERE MAP_SVR_GROUP = @iMapSvrGroup)
	BEGIN
		UPDATE MuCastle_DATA 
		SET CASTLE_OCCUPY = @iCastleOccupied, OWNER_GUILD = @szOwnGuildName
		WHERE MAP_SVR_GROUP = @iMapSvrGroup
		UPDATE Guild SET csWins = csWins + 1 WHERE G_Name = @szOwnGuildName
		SELECT 1 As QueryResult
	END
	ELSE
	BEGIN
		SELECT 0 As QueryResult
	END

	IF(@@Error <> 0 )
		ROLLBACK TRANSACTION
	ELSE	
		COMMIT TRANSACTION

	SET NOCOUNT OFF	
END
Leave a Comment