Hi how can i send items directly to there event or item mall inventory? please need some help .
GOQuote:
Hi how can i send items directly to there event or item mall inventory? please need some help .
INSERT INTO [RohanGame].[dbo].[TEventItem] SELECT
1 -- [type]
,0x00 -- attr
,1 -- stack
,1 -- rank
,1 -- equip level
,1 -- str
,1 -- dex
,1 -- int
,id -- char id
, GETDATE() -- date
FROM RohanGame.dbo.TCharacter
The only difference is that zzerachiel your code does not loop. Inserts one record at a time.Quote:
It's a bit more elegant this way
GO DECLARE @a Integer = 100 DECLARE @i Integer SELECT @i = COUNT(id) FROM dbo.TCharacter SET @i = @i + 100 WHILE (@a < @i) BEGIN INSERT INTO dbo.TEventItem (type, attr, stack, rank, equip_level, equip_dexterity, equip_intelligence, equip_strength, char_id) VALUES (0, 0, 0, 0, 0, 0, 0, 0, @a) SET @a = @a + 1 END
You're right with the Loop loses a bit of performance.Quote:
Since when looping a few thousand times is better than adding all of them at once?
Not to mention that with my code you don't need to know the starting character id, nor the end.
What would your code do if there are gaps in the character_id?
I mean, it's nice that you managed to get a one line statement and turn it into 10 lines, while loosing performance.
omg!! what hell is that of pict .. seem i need re-school to understand it :DQuote:
[Only registered and activated users can see links. Click Here To Register...]
Works.
All i said is that my code is a bit more elegant.
How to send it if certain players?Quote:
It's a bit more elegant this way
Code:INSERT INTO [RohanGame].[dbo].[TEventItem] SELECT 1 -- [type] ,0x00 -- attr ,1 -- stack ,1 -- rank ,1 -- equip level ,1 -- str ,1 -- dex ,1 -- int ,id -- char id , GETDATE() -- date FROM RohanGame.dbo.TCharacter