المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : بخصوص ال union


sobhe_wizard
01-02-2017, 01:01 PM
دلوقتي في مشكله الناس في السيرفر مش عارفه تعمل union بيعملو كل حاجه و لما بيدوسو OK علشان يقبلو ال union مفيش حاجه بتحصل

MrGame3
01-02-2017, 05:21 PM
جرب ال كويري ده

USE [SRO_VT_SHARD]

GO
/****** Object: StoredProcedure [dbo].[_Guild_Create] Script Date: 14.06.2014 16:53:19 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO




--
ALTER PROCEDURE [dbo].[_Guild_Create]
@guildName varchar(64),
@CreaterID int
as
if (exists (select id from _Guild where Name = @guildName))
begin
return -1000
end
if (exists (select CharID from _GuildMember where CharID = @CreaterID))
begin
return -1001
end
begin transaction

declare @guildID int
declare @FoundationDate smalldatetime

set @FoundationDate = GetDate()
insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_1', 1, 0, @FoundationDate,0,0)
insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_2', 1, 0, @FoundationDate,0,0)
insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_3', 1, 0, @FoundationDate,0,0)
insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_4', 1, 0, @FoundationDate,0,0)
insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName+'_ULimit_5', 1, 0, @FoundationDate,0,0)


insert _Guild(Name, Lvl, GatheredSP, FoundationDate,Alliance,Booty) values @guildName, 5, 0, @FoundationDate,0,0)
set @guildID = @@identity

if (@@error <> 0 or @@rowcount = 0 or @guildID = 0)
begin
rollback transaction
return -5
end


--길드ى‍¥ى‌€ يچ¼ë¯¸ى…کى‌´ 0xffffffff !!
declare @rvalue int
exec @rvalue = _Guild_FnAddMember @guildID, @CreaterID, 0, @FoundationDate,0xffffffff
if (@@error <> 0 or @rvalue <= 0)
begin
rollback transaction
return @rvalue
end

-- 길드 ى°½ê³*를 ىƒ‌ى„±ي•کى‍گ
exec @rvalue = _Guild_CreateChest_NoTX @guildID
if (@@error <> 0 or @rvalue <= 0)
begin
rollback transaction
return @rvalue
end


commit transaction
return @guildID

Dev.Ri3o
02-02-2017, 02:43 AM
اعمل دول

USE [SRO_VT_SHARD]
GO
/****** Object: StoredProcedure [dbo].[_AllianceCreate] Script Date: 2/2/2017 1:40:49 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[_AllianceCreate]

@CreatorGuildID int,
@FirstAllyGuildID int
AS

set xact_abort on
begin transaction
declare @AllianceID int
set @AllianceID = 0
Insert into _AlliedClans values(@CreatorGuildID,@FirstAllyGuildID,0,0,0,0,0 ,0,GetDate(),0,0)
if (@@error <> 0 or @@rowcount = 0)
begin
rollback transaction
return -1
end
set @AllianceID = @@identity
if( @AllianceID = 0 )
begin
rollback transaction
return -2
end
update _Guild set Alliance = @AllianceID where id in (@CreatorGuildID, @FirstAllyGuildID)
if( @@error <> 0 or @@rowcount <> 2 )
begin
rollback transaction
return -3
end
commit transaction
return @AllianceID



USE [SRO_VT_SHARD]
GO
/****** Object: StoredProcedure [dbo].[_AllianceRemove] Script Date: 2/2/2017 1:41:44 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-------------------------------------------------------------
ALTER PROCEDURE [dbo].[_AllianceRemove]
@AllianceID int
AS
if( not exists( select id from _AlliedClans where id = @AllianceID ) )
begin
return 0
end
set xact_abort on
begin transaction
--ى‌¼ë‹¨ ى†Œى†چ 길드부ي„° ê°•ى*œ يƒˆي‡´ë‹¤!
update _Guild set Alliance = 0 where Alliance = @AllianceID
if (@@error <> 0 or @@rowcount = 0)
begin
rollback transaction
return 0
end
--ëڈ™ë§¹ ë‚*린다
delete _AlliedClans where id = @AllianceID
if (@@error <> 0 or @@rowcount = 0)
begin
rollback transaction
return 0
end
commit transaction
return 1

sobhe_wizard
02-02-2017, 07:37 PM
تم الحل شكرا ليكو
#يغلق

Dev.Ri3o
02-02-2017, 07:59 PM
##