Hi, I'm loading a large amount of data from a SSIS package into an empty database. I have triggers on various tables that do lookups to ensure that multiple values aren't being inserted more than once. This works beautifully and quickly for all of my imports, save one, where the unique values is, unfortunately, a string. I've put an index on this column but it, for obvious reasons, quickly becomes fragmented. I'm looking at two possibilities...
*Remove the unique string value from the main table and then create a PK/FK relationship between the two so that the lookup is being done against an INT rather than a a string. I'd prefer not to do this as these string values are completely unique and, once indexed fully, should be fairly quick to lookup, and I don't really relish creating a one-to-one relationship in such a scenario. Call it personal preference...call me wrong.
OR
*Try to find a low-impact script (at least, as low-impact as possible) that I could append to my trigger which would check the indexes on a certain table (or even better, just the index that I'm concerned with, IX_PERMID) for fragmentation levels and, if over a certain threshhold, do a ReOrg.
Either way, this feels hackish, but I'm just trying to get this initial import out of the way.