SQL Server : ALTER TABLE ADD COLUMN MAXDOP=1

笑着哭i 提交于 2019-12-11 14:12:22

问题


I am trying to suppress parallelism in SQL Server while altering a table to add a column with the option maxdop=1. However I get an error in the syntax. I tried several ways but I can make it work, does anybody know how to use this option when adding a column?

ALTER TABLE [dbo].[mytable] 
ADD neColumn varchar(max)
WITH (MAXDOP = 1);


回答1:


Pretty sure you can't use query hint for an alter table.

See list at https://msdn.microsoft.com/en-us/library/ms181714.aspx

Depending on what you want to do, you may want to set the server parallelism to 1 before you run your query and set it back to its initial value once you are done.

check https://msdn.microsoft.com/en-us/library/ms189094.aspx to do so.



来源:https://stackoverflow.com/questions/37023344/sql-server-alter-table-add-column-maxdop-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!