> I have an identity column defined on a table and need to
> change it to use the NOT FOR REPLICATION option. I've
> read and re-read the ALTER TABLE documentation and i'm
> not clear on the syntax, or whether or not this is
> possible.
You can't use ALTER TABLE for this. Here's a demo:
CREATE TABLE dbo.AlterIdentityDemo
(
col1 int IDENTITY,
col2 char(1) NOT NULL
)
go
insert AlterIdentityDemo(col2)
select 'a'
union all
select 'b'
union all
select 'c'
go
EXEC sp_rename
'dbo.AlterIdentityDemo','AlterIdentityDemo_04182003181434000',OBJECT
go
CREATE TABLE dbo.AlterIdentityDemo
(
col1 int IDENTITY NOT FOR REPLICATION,
col2 char(1) NOT NULL
)
go
SET IDENTITY_INSERT dbo.AlterIdentityDemo ON
go
INSERT INTO dbo.AlterIdentityDemo(
col1,
col2
)
SELECT
col1,
col2
FROM dbo.AlterIdentityDemo_04182003181434000
go
SET IDENTITY_INSERT dbo.AlterIdentityDemo OFF
go
HTH,
Bob Barrows