July 14, 2009 at 4:12 am
I have an SP which turns of IDENTITY so I can add in inforamtion in to the gaps in the IDENITY column (ie. if the identity cloumn is 1,2,3,4,7,8,9 is will insert the nextt rows at 5,6 and then 10).
when finished it will turn identity_insert back on.
While this processes is running will all processes effectivly have the IDENTITY insert off for this table as well or is this only local to the store procedure?
Many thanks
July 14, 2009 at 4:50 am
set identity_insert is at session level !
So it will only be active with your session for your session !
Why are you trying to fill the gaps ?
Are you reaching the min/max integer barriers ?
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
July 14, 2009 at 4:51 am
It is session based command.In your session if you set this option ON for one table,you cannot set it ON for another table.Server level will not be affected.
July 14, 2009 at 5:28 am
ALZDBA (7/14/2009)
set identity_insert is at session level !So it will only be active with your session for your session !
Why are you trying to fill the gaps ?
Are you reaching the min/max integer barriers ?
Great so I can freely run this and any other users inserts will be added as normal.
Yep we are filling the gaps as we are reaching the min/max integer barriers.
Many thanks
July 14, 2009 at 6:59 am
- that would be a table with +- 4,000,000,000 rows .... nice
- double check you have an index on that identity column
- Make sure you use the propper technique to find your gaps !
e.g. Generating Missing Dates and Numbers http://www.sqlservercentral.com/articles/Datetime+Manipulation/61822/
Maybe its just better to get a maintenance window to rearrange your identity data!This may take some time, but will pay off in the long run, if you implemented surrogate keys.
(and therefor will only have to modify the table itself and the first level of dependant (referencing) tables)
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
July 19, 2009 at 11:09 pm
Edward (7/14/2009)
Yep we are filling the gaps as we are reaching the min/max integer barriers.
Save yourself and others the pain... simply switch the column datatype to BIGINT. You will never run out of numbers ever again.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply