.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Unable to alter table that is beeing replicated

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :Sql Server

We are using SQL Server 2008 and transaction replication. I have set up the publication so that it is replicating schema changes but today i discovered that I was unable to add a column to one table that also is an article in the publication. The error I get is this:

Altering [dbo].[Group]
Msg 650, Level 16, State 1, Procedure sp_MSreinit_article, Line 66
You can only specify the READPAST lock in the READ COMMITTED or REPEATABLE READ isolation levels.

Have anyone any clue of what this can be?



View Complete Post

More Related Resource Links

SMO classes to generate alter table script to add columns

How to generate ALTER TABLE script to add columns using SMO and c#.

unable to create new table in sql server 2000 enterprise manager on windows7(Operating system)

i have successfuly installed sql server 2000 on windows7 and i am able to browse all the tables and edit aswell(on enterprise manager) but i have a problem while creating new tables it says ' MMC has detected an error in a snap-in' and provides options to either continue with the error or send a report to microsoft ,   Please help regarding this compatibility issue   Thanks in advance !

Right click script alter table disabled

Does anyone know how to enable the "Script Table As" -> "Alter To" option in SQL Server 2008 SSMS? John M. Couch Insight Enterprises Inc. 6820 S. Harl Ave, Tempe, Az 85283 Email: john.couch@insight.com

add new table to replicated db

Hi , we have big DB and it is replicated to another site through wan connection, now we want to add new table (article) (from the source db) to this replicated db without restarting the replication from the zero point, can we do that? thanks

is Alter table a fully logged operation

Hello, A friend of mine has a very large table which has a column of type int. Since this table is growing very fast he wanted to alter the table to change the data type from int to bigint. when he did that, he found that he ran out of disk space on the t-log volume. (600 GB of free space). why did this happen? shouldn't the type change be a meta data change operation? why was the t-log so heavily used on change of type?

lookup: unable to allocate memory for hash table

Hi, I have been getting an error from a lookup component when I run it from the job agent. However, it works just fine from debug mode. the specific error is 0xC0208247: unable to allocate memory for hash table. I get the same error when I run this not in full-cach but in partial and no cache. Also, the default butter max row and buffer size in package are set to default. Does anyone have any idea.   Jon

Alter Table add column

Hi all, ALTER TABLE dbo.tbl_allocation ADD calc_method [decimal](38, 6) ADD allocation_percentage [decimal] (38, 6) when i run this i get the following message: incorrect syntax near decmial. please help

Upgrading timestamp column to rowversion (alter table)

Hi, We are upgrading 2005 to 2008 and observed that time stamp data type is deprecated, and should be using rowversion instead. So I started doing alter table for a table with timestamp to rowversion and the alter table failed with the error "cannot alter column 'rv' to be data type timestamp. Can some one please let me know what I am missing here? thanks, Sivakumar

Alter table error


continue to get this error and cannot figure out why

Msg 102, Level 15, State 1, Line 1

Incorrect syntax near '('

This is the code;  - error refers to the '(' at end of Alter Table line





/****** Object: Table [dbo].[MarkData] Script Date: 09/22/2010 10:17:06 ******/





Unable to create table dynamically in database


I am able to create database through script generated by SQL Server 2008 but unable to create tables from generated script. Please indicate if any step is missing.


************* Code *******************

 public bool CreateAppTables(string DatabaseName, string ConnectionString)
        string DatabaseScript;
        DatabaseScript = Activity.readTextFile(HttpContext.Current.Server.MapPath(".") + "/functionalscripts/CreateTablesonly.sql");
        DatabaseScript = DatabaseScript.Replace("DatabaseNametoChange", DatabaseName);
        return ActionQueryDB(DatabaseScript, ConnectionString);


 public bool ActionQueryDB(string SQLStatement, string ConnectionString)
        //  SqlConnection cn;

        OleDbConnection cn = new OleDbConnection();

        cn.ConnectionString = ConnectionString;
            OleDbCommand cmd = new OleDbCommand();
            cmd.CommandText = SQLStatement;
            cmd.Connection = cn;

            return true;
        catch (Exception ex)

            return false;


****************** Contents of text file appe

It is possible to alter multiple columns within a single alter table statement?


It is possible to alter multiple columns within a single alter table statement?

I tried & searched not getting it.

Alter table au_de alter column m_user char(9),c_user char(9)

Msg 102, Level 15, State 1, Line 1

Incorrect syntax near ','.


Alter table au_de alter column m_user char(9),alter column c_user char(9)
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.

Alter table nockeck constr with VAR


Hi all,


When i run this query:

declare @FK_Name varchar(500)
declare @UT_Name varchar(500)
set @UT_Name = Table_Name
set @FK_Name = FK_Name
alter table @UT_Name nocheck constraint @FK_Name

I get this error msg:

Incorrect syntax near '@UT_Name'.

I guess The problem is in the last dtring of the query.

What should i change in order it works?


Thank you


Alter a replicated column


Hi all,

I've a transactional replica scenario which basically has one pubblication (with some table) and a lot of subscriptions. All is working fine from some months. Now I've to alter a column of one of the replicated table: now it is a varchar(40) and it will be varchar(500). When I try to execute the sql script to alter that column I receive an error because the column is replicated. I think I've to drop all subscriptions, alter the column, rebuild the subscriptions. Is there a fast way?

Thank you all

The ALTER TABLE statement conflicted with the FOREIGN KEY constraint


The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "fk_Allergy". The conflict occurred in database "MSCPROJECT", table "dbo.Severity", column 'SeverityCode'.

SQL Server 2008 - Alter Table Switch Statement Fails Where Partition Key Defined as a Persisted Comp


Here's a very annoying and poorly (or undocumented) issue in SQL Server 2008 Ent. Ed. post-SP1, CU8:

When creating a table with a persisted computed column as the clustered primary and partitioning key (see below), where the computation includes a call to CONVERT, watch out for the representation of this calculation on sys.computed_columns.  The query parser will modify the definition at table creation to insert a default style parameter of "(0)", if no other style is specified.  If the original definition did not include any style parameter and you later attempt to programmatically recreate the table using the stored definition contained on sys.computed_columns, the query optimizer will throw an error when you then attempt to switch partitions from the original table into the new programmatically created table, as follows:

Msg 4966, Level 16, State 1, Line 72

ALTER TABLE SWITCH statement failed. Computed column '%' defined as '%' in table %' is different from the same column in table %' defined as '%'.

This is so, eventhough the two definitions are completely functionally equivalent, considering the default value of the style parameter.  This can cause a lot of headaches, because correcting the problem requires dropping and rebuilding the computed column with a definition that include

how to execute ALTER table for multiple columns


I have an SQL table called tbl, im trying to add the columns A, B and C to it.

When i execute the command :

 addcolumns = "ALTER TABLE SqlCreatedTbl ADD A char(50) ;";


 cmd = new SqlCommand(addcolumns, conn);

conn.Open(); cmd.ExecuteNonQuery();

The column is added perfectly and i can see it in the table !

However, when i try to add multiple columns, it does NOT work, it gives me an error..

the command im writting for adding multiple columns is the following:

addcolumns = "ALTER TABLE SqlCreatedTbl ADD ( A char(50), B char(50), C char(50) );";

the debugger highlights the line : cmd.ExecuteNonQuery(); and throws the following exception: Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near '('.


Insufficient Permissions to alter table in SSMS Design View, can run ALTER Table successfully

Hello, are the permissions in the object explorer in management studio different for a login than what can be run in a query window for the same login? I have a developer I gave ddladmin so he can create/modify tables. He can open the table in design view in object explorer (gets a warning about possible insufficient permissions when he opens) but when he tries to add a column it fails with a permissions error. He scripted off the change and ran it in a query window, which worked fine. Any insight would be appreciated. Thanks.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend