sql-server – 更改列约束null / not null = rowguid复制错误

我有一个sql server 2005下运行的数据库,带有合并复制.我想将一些FK列更改为“not null”,因为它们应始终具有值. sql服务器不会让我这样做,这就是它所说的:
  • Unable to modify table. It is invalid to drop the default constraint
    on the rowguid column that is used by
    merge replication. The schema change
    Failed during execution of an internal
    replication procedure. For corrective
    action,see the other error messages
    that accompany this error message. The
    transaction ended in the trigger. The
    batch has been aborted.

我根本不想改变对rowguid列的约束,只是在另一个充当FK的列上.我想要设置的其他列不为null,因为没有该信息(即客户,客户名称)记录没有任何意义.

问题:
有没有办法在不关闭复制然后重新打开它的情况下将列更新为“非空”?
这甚至是最好的方法 – 我应该使用约束吗?

解决方法

显然,SSMS通过删除表并重新创建表来对表进行更改.所以只需要使用T-sql语句进行更改.
ALTER TABLE dbo.MyTable ALTER COLUMN MyColumn nvarchar(50) NOT NULL

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...