document/常用SQL/历史/游戏多语言.sql
2024-09-08 22:06:12 +08:00

97 lines
2.7 KiB
Transact-SQL
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters
-- command (Ctrl-Shift-M) to fill in the parameter
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: 同步游戏多语言将AppId4的语言同步到其他AppId
-- =============================================
CREATE PROCEDURE [dbo].[Game_Multilingual_Synchronization]
AS
BEGIN
declare @DefaultCfgCount int ;--蘑菇主包的语言数量
declare @CfgAppId int ;--AppId
declare @CfgCount int ;--其他Appid语言的数量
select @DefaultCfgCount=count(1) from MoguExt.dbo.T_Multilingual_Cfg where appid=4 and Extended1='游戏';
DECLARE CfgData_Cursor CURSOR FOR
select AppId,count(1) from MoguExt.dbo.T_Multilingual_Cfg where appid!=4 and Extended1='游戏' group by AppId;
--打开游标
OPEN CfgData_Cursor
FETCH NEXT FROM CfgData_Cursor INTO @CfgAppId,@CfgCount
--循环
WHILE @@FETCH_STATUS = 0
BEGIN
if @CfgCount<@DefaultCfgCount
begin
Print ('同步属地==》'+Convert(nvarchar(100),@CfgAppId)+'原数量==>'+Convert(nvarchar(100),@CfgCount));
insert into MoguExt.dbo.T_Multilingual_Cfg([ResId]
,[CfgType]
,[ResType]
,[Language]
,[Value]
,[Uri]
,[Explain]
,[IsExport]
,[CreateTime]
,[Extended1]
,[Extended2]
,[ExtendedInt1]
,[ExtendedInt2]
,[AppId]
,[Title]
,[Title2]
,[ImageId]
,[ImageId2]
,[ImageId3]
,[ImageId4])
select [ResId]
,[CfgType]
,[ResType]
,[Language]
,[Value]
,[Uri]
,[Explain]
,[IsExport]
,[CreateTime]
,[Extended1]
,[Extended2]
,[ExtendedInt1]
,[ExtendedInt2]
,@CfgAppId
,[Title]
,[Title2]
,[ImageId]
,[ImageId2]
,[ImageId3]
,[ImageId4] from MoguExt.dbo.T_Multilingual_Cfg where Extended1='游戏' and appid=4 and Value not in (
select Value from MoguExt.dbo.T_Multilingual_Cfg where appid=@CfgAppId and Extended1='游戏' )
end
else
begin
print('appid{'+Convert(nvarchar(100),@CfgAppId)+'}不需要同步')
end
FETCH NEXT FROM CfgData_Cursor INTO @CfgAppId,@CfgCount
END;
--关闭游标
CLOSE CfgData_Cursor;
DEALLOCATE CfgData_Cursor;
END
GO