It's (yet) an old thread and may be only used by a few, but ...
- the given SQL script "mobItems.sql" rises some remarks:
1) it contains 26181 insert statements (and 104745 lines) to more or less perform the following:
Code:
USE [PS_GameDefs]
GO
CREATE TABLE [dbo].[MobItemsNEW] (
[RowID] [int] NOT NULL IDENTITY (1, 1),
[MobID] [smallint] NOT NULL,
[ItemOrder] [tinyint] NOT NULL,
[Grade] [smallint] NOT NULL,
[DropRate] [int] NOT NULL,
[MapID] [smallint] NULL);
GO
DECLARE @cntMob int -- the number of mobs to insert
DECLARE @mobID int -- the ID of mob in loop
DECLARE @drop int -- the ID of drop in loop
-- define the number of mobs to create
SET @cntMob = 2908
-- let the base generates the right RowID identity value
SET IDENTITY_INSERT [dbo].[MobItemsNEW] OFF
SET @mobID = 0
WHILE (@mobID < @cntMob)
BEGIN
-- insert 9 records matching 9 drop of current mob
SET @drop = 1
WHILE (@drop <= 9)
BEGIN
INSERT INTO [dbo].[MobItemsNEW] VALUES (@mobID, @drop, 0, 0, NULL)
SET @drop = @drop +1
END
SET @mobID = @mobID + 1
END
even with comments, this version needs 36 lines.
so the remark: when you have / want to use code to generate a repetitive SQL script, use the same logic (code) in the SQL script to not have such repetitions.
2) the definition of an extra column 'mapID' to the table can indeed be helpful.
the column will not grant that all mobs are present in a single map (it's not its purpose) but will allow to do some select and update on the map criterion.
however, as indicated by n00bness, the right way to do it is to alter the current table, so something like:
Code:
ALTER TABLE [dbo].[MobItems] ADD [MapID] [smallint] DEFAULT NULL
3) as a matter of fact, and fact only, the scripts generated by shStudio (0.7.1) won't comply with the new table format.