2012年3月7日星期三

Disabling the identity column

I have a table that I want to disable the identity column that will be
disabled across different sessions. I cannot use SET IDENTITY_INSERT
table off as it does not persist across columns.
I also do not want to create a tmp table without the identity being
turned on, populate it and then rename the table as this seems a bit
time consuming on a large recordset.
Is there another way?
I will be using SQL server 2000 and/or ado.net
Thanks
Rippo
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!The only way is to drop the column.
AMB
"Rippo" wrote:

> I have a table that I want to disable the identity column that will be
> disabled across different sessions. I cannot use SET IDENTITY_INSERT
> table off as it does not persist across columns.
> I also do not want to create a tmp table without the identity being
> turned on, populate it and then rename the table as this seems a bit
> time consuming on a large recordset.
> Is there another way?
> I will be using SQL server 2000 and/or ado.net
> Thanks
> Rippo
> *** Sent via Developersdex http://www.examnotes.net ***
> Don't just participate in USENET...get rewarded for it!
>|||If you can't SET IDENTITY_INSERT for each session then you'll have to
use a non-identity column instead. Why are you using an IDENTITTY in
this situation? The point of an auto-generated surrogate key is that
you shouldn't care what value is inserted. If you want to control the
values externally then IDENTITY isn't the right solution.
--
David Portas
SQL Server MVP
--

没有评论:

发表评论