Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
Backups
»
Identity insertion and updation
15 posts, Page 2 of 2
««
1
2
Identity insertion and updation
Rate Topic
Display Mode
Topic Options
Author
Message
Greg Charles
Greg Charles
Posted Tuesday, January 08, 2008 12:13 PM
SSCarpal Tunnel
Group: General Forum Members
Last Login: Yesterday @ 3:50 PM
Points: 4,006,
Visits: 4,847
I'm a little confused. Early in the thread it sounded like you want to remove the identity property and retain the data, but your last post sounds like you are okay with dropping the columns with identity property from the tables.
Are you ultimately wanting to have 500 tables with no identity columns?
Greg
Greg
Post #440223
Jeff Moden
Jeff Moden
Posted Tuesday, January 08, 2008 7:02 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Yesterday @ 9:57 PM
Points: 32,906,
Visits: 26,790
balaji_rcs (12/24/2007)
Hi,
Thanks for your reply. I want to remove the identity properties in the table totally. i.e I want to remove the identity while update also.
Yeah, uh-huh... what are you going to use to replace the auto-numbering property of the IDENTITY property? Sequence table? Better post that code so we can check it or you'll end up with a bazillion deadlocks per day. SELECT MAX()? Again, better post that code so we can make sure that you won't end up with dupe ID's on a high usage system.
And, then, you might as well convert all of your code to bloody cursors because you're gonna have a hell of a time inserting more than one row at a time no matter which of those two methods you use. If you have a third method not offered above, please post it... I want to see what type of knife you're falling on ;)
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #440377
Jeff Moden
Jeff Moden
Posted Tuesday, January 08, 2008 7:05 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Yesterday @ 9:57 PM
Points: 32,906,
Visits: 26,790
Kishore.P (1/8/2008)
use sp_msforeachtable to drop the identity column in all tables.
Yup... easy to do if no foreign keys... of course, if these IDENTITY columns are being used as the PK for tables, your whole database becomes a useless piece of slag.
C'mon folks! Doesn't anyone else see a problem with this request???
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #440378
G.R.Prithiviraj Kulasingham
G.R.Prithiviraj Kulasingham
Posted Sunday, January 24, 2010 11:48 PM
SSC-Addicted
Group: General Forum Members
Last Login: Sunday, October 21, 2012 8:59 PM
Points: 421,
Visits: 362
Removing identity property is something I have seen many people doing for some reason.
Most of the time, they perform an additional query to get the next value and then pass it. This method creates additional locks and will not work perfectly in a multi user environment.
I believe identity is one of the good things SQL Server has.
Having said that, there is another way of moving them. It will work better if you do not have foreign keys defined against this table and this table is large.
As of now, it will work only in enterprise edition of SQL Server 2005, but I believe it will work in some additional editions of SQL Server 2008
1. Create another table with the same structure except the identity property.
2. Switch the data from old table to new table
3. Drop the old table (which has the identity property)
4. Rename the new table with proper name.
In case you have soem foreign keys you need to drop the foreign keys and re-create them.
I heard that SQL Server mobile edition has a command where you can simply turn off the identity property, but it is not yet available on other editions.
Cheers,
Prithiviraj Kulasingham
http://preethiviraj.blogspot.com/
Post #852848
G.R.Prithiviraj Kulasingham
G.R.Prithiviraj Kulasingham
Posted Sunday, January 24, 2010 11:50 PM
SSC-Addicted
Group: General Forum Members
Last Login: Sunday, October 21, 2012 8:59 PM
Points: 421,
Visits: 362
Oops I just realized that this is quite old thread. I am not sure why it suddenly came into my screen.
Cheers,
Prithiviraj Kulasingham
http://preethiviraj.blogspot.com/
Post #852850
« Prev Topic
|
Next Topic »
15 posts, Page 2 of 2
««
1
2
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.