改变表格添加多列ms sql

任何人都可以告诉我在下面的查询错误在哪里

ALTER TABLE Countries ADD ( HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit, HasText bit); ALTER TABLE Regions ADD ( HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit HasText bit); ALTER TABLE Provinces ADD ( HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit HasText bit); ALTER TABLE Cities ADD ( HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit HasText bit); Alter table Hotels Add { HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit, HasHotelPhotoInReadyStorage bit, HasHotelPhotoInWorkStorage bit, HasHotelPhotoInMaterialStorage bit, HasReporterData bit, HasMovieInReadyStorage bit, HasMovieInWorkStorage bit, HasMovieInMaterialStorage bit }; 

我得到以下错误:

 Msg 102, Level 15, State 1, Line 2 Incorrect syntax near '('. Msg 102, Level 15, State 1, Line 9 Incorrect syntax near '('. Msg 102, Level 15, State 1, Line 15 Incorrect syntax near '('. Msg 102, Level 15, State 1, Line 22 Incorrect syntax near '('. Msg 102, Level 15, State 1, Line 29 Incorrect syntax near '{'. 

拿出圆括号和大括号,添加列时都不需要。

您需要删除括号

 ALTER TABLE Countries ADD HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit, HasText bit; 

这应该在T-SQL中工作

 ALTER TABLE Countries ADD HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit, HasText bit GO 

http://msdn.microsoft.com/en-us/library/ms190273(SQL.90).aspx

 Alter table Hotels Add { HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit, HasHotelPhotoInReadyStorage bit, HasHotelPhotoInWorkStorage bit, HasHotelPhotoInMaterialStorage bit, HasReporterData bit, HasMovieInReadyStorage bit, HasMovieInWorkStorage bit, HasMovieInMaterialStorage bit }; 

上面你使用{,}。

此外,你错过了逗号:

 ALTER TABLE Regions ADD ( HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit <**** comma needed here HasText bit); 

您需要删除括号,并确保所有列在必要时都有逗号。

 ALTER TABLE Regions ADD ( HasPhotoInReadyStorage bit, HasPhotoInWorkStorage bit, HasPhotoInMaterialStorage bit *(Missing ,)* HasText bit);