Link to home
Start Free TrialLog in
Avatar of fortuna_techmy
fortuna_techmy

asked on

alter table TB alter column rNo IDENTITY (1, 1) NOT FOR REPLICATION NOT NULL

Greetings.

I want change all the Running no from
                      [Rno] [numeric](18, 0) IDENTITY (1, 1) NOT NULL                              
                       to
                      [Rno] [numeric](18, 0) IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL


2 problems :
a) I cannot use ALTER TABLE to change it to     IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL. Note all the tables already have records
b) All the tables need to be changed.  I need to use a while loop to go thru all the tables (excluding system tables)  and update to   [Rno] [numeric](18, 0) IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL

Thank you.



CREATE TABLE [dbo].[test] (
      [Rno] [numeric](18, 0) IDENTITY (1, 1) NOT NULL ,
      [icno] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
      [name] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO

alter table test alter column    
[Rno] [numeric](18, 0) IDENTITY (1, 1) NOT FOR REPLICATION  NOT NULL


ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial