Solved

SQL 2000 Script to IDENTITY KEY TO NOT FOR REPLICATION

Posted on 2006-11-20
4
291 Views
Last Modified: 2011-09-20
Can you please write a script that will set IDENTITY COLUMN to NOT FOR REPLICATION rather than going into Design table to do it.

I want a script that can do it for all tables with IDENTITY COLUMNS & rimary key

I try below script it give error:

alter table tb_Benefit

alter column b_SID add  NOT FOR REPLICATION

Error:Server: Msg 170, Level 15, State 1, Line 5
Line 5: Incorrect syntax near 'NOT'.


 
0
Comment
Question by:Richardsoet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17981336
the script needs to be rather like this:
alter yourtable alter column b_SID INT  NOT FOR REPLICATION

0
 

Author Comment

by:Richardsoet
ID: 17982413
it does not seem to work, your script is the same as the one i posted in my question , it errors please have a look at the one i posted and compare to yours.am running sql2000
0
 
LVL 20

Expert Comment

by:Sirees
ID: 17982631
0
 
LVL 14

Accepted Solution

by:
profya earned 250 total points
ID: 18014883
The ALTER COLUMN part of the ALTER TABLE syntax in SQL Server 2000 does not support chaning any of the IDENTITY-related properties including the NOT FOR REPLICATION. The only available ways as I can see is to:
1) drop the column and redefine it again using ALTER TABLE table_name ADD column_name data_type syntax
2) Export your data, generate SQL Script and use the normal text Replace on the generated SQL Script, run the script and then import you data back.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
As technology users and professionals, we’re always learning. Our universal interest in advancing our knowledge of the trade is unmatched by most industries. It’s a curiosity that makes sense, given the climate of change. Within that, there lies a…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question