SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[forums_system_Import_ForumGroup]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[forums_system_Import_ForumGroup]
GO




create PROCEDURE forums_system_Import_ForumGroup
(
	@ForumGroupID int,
	@Name nvarchar(256),
	@SortOrder int
)
AS
BEGIN

	IF EXISTS(SELECT * FROM forums_ForumGroups WHERE ForumGroupID = @ForumGroupID)
		UPDATE
			forums_ForumGroups
		SET 
			Name = @Name,
			SortOrder = @SortOrder
		WHERE
			ForumGroupID = @ForumGroupID
	ELSE
	BEGIN
		SET IDENTITY_INSERT forums_ForumGroups ON
		INSERT INTO
			forums_ForumGroups
			(
				ForumGroupID,
				Name,
				SortOrder
			)
		VALUES
			(
				@ForumGroupID,
				@Name,
				@SortOrder
			)
		SET IDENTITY_INSERT forums_ForumGroups OFF
	END
END



GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

