Visual Studio数据库项目在本地计算机上生成,但在生成服务器上失败

时间:2019-01-18 22:15:30

标签: sql-server tfs msbuild continuous-integration dac

我正在尝试为我的数据库项目设置CI,但遇到一个困扰我的问题。我可以在我的机器上成功构建项目;但是,当我签入对TFS的更改,并且构建服务器尝试构建项目时,几乎每个表和视图都会出现错误,如下所示:

Phase 1 - 11187 error(s), 556 warning(s)
SAS\dbo\Tables\CohortEntry.sql(12):SAS\dbo\Tables\CohortEntry.sql(12,1): Error SQL70001: This statement is not recognized in this context.
SAS\dbo\Tables\CohortEntry.sql(14):SAS\dbo\Tables\CohortEntry.sql(14,1): Error SQL70001: This statement is not recognized in this context.
SAS\dbo\Tables\CohortEntry.sql(16):SAS\dbo\Tables\CohortEntry.sql(16,1): Error SQL70001: This statement is not recognized in this context.
SAS\dbo\Tables\CohortEntry.sql(18):SAS\dbo\Tables\CohortEntry.sql(18,1): Error SQL70001: This statement is not recognized in this context.
SAS\dbo\Tables\CohortEntry.sql(20):SAS\dbo\Tables\CohortEntry.sql(20,1): Error SQL70001: This statement is not recognized in this context.
SAS\dbo\Tables\CohortEntry.sql(22):SAS\dbo\Tables\CohortEntry.sql(22,1): Error SQL70001: This statement is not recognized in this context.
SAS\dbo\Tables\CohortEntry.sql(24):SAS\dbo\Tables\CohortEntry.sql(24,1): Error SQL70001: This statement is not recognized in this context.
SAS\dbo\Tables\CohortEntry.sql(26):SAS\dbo\Tables\CohortEntry.sql(26,1): Error SQL70001: This statement is not recognized in this context.
SAS\dbo\Tables\CohortEntry.sql(28):SAS\dbo\Tables\CohortEntry.sql(28,1): Error SQL70001: This statement is not recognized in this context.
SAS\dbo\Tables\CohortEntry.sql(30):SAS\dbo\Tables\CohortEntry.sql(30,1): Error SQL70001: This statement is not recognized in this context.
SAS\dbo\Tables\CohortEntry.sql(32):SAS\dbo\Tables\CohortEntry.sql(32,1): Error SQL70001: This statement is not recognized in this context.

此特定文件中失败的代码是:

CREATE TABLE [dbo].[CohortEntry] (
    [idCohortEntry] INT           IDENTITY (1, 1) NOT NULL,
    [CohortEntry]   NVARCHAR (50) NULL,
    [CohortLevel]   NVARCHAR (1)  CONSTRAINT [DF_CohortEntry_CohortLevel] DEFAULT (N'S') NOT NULL,
    [CohortCode]    NVARCHAR (3)  NOT NULL,
    CONSTRAINT [PK_CohortEntry] PRIMARY KEY CLUSTERED ([idCohortEntry] ASC)
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_DefaultView', @value = 2, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Contains one entry for every cohort of Students or Requests described by the SAS.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Filter', @value = NULL, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_OrderBy', @value = NULL, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_OrderByOn', @value = 0, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Orientation', @value = 0, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_TableMaxRecords', @value = 10000, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnHidden', @value = 0, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'idCohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnOrder', @value = 0, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'idCohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnWidth', @value = -1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'idCohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'A unique serial key.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'idCohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnHidden', @value = 0, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnOrder', @value = 0, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnWidth', @value = 1815, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'A description for this cohort entry.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortEntry';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnHidden', @value = 0, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortLevel';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnOrder', @value = 0, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortLevel';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnWidth', @value = -1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortLevel';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'A flag indicating whether this cohort entry refers to Student (S) or Request (R) cohorts.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortLevel';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnHidden', @value = 0, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortCode';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnOrder', @value = 0, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortCode';


GO
EXECUTE sp_addextendedproperty @name = N'MS_ColumnWidth', @value = -1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortCode';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'The unique three-character code that defines this cohort.', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'CohortEntry', @level2type = N'COLUMN', @level2name = N'CohortCode';

我不太确定问题出在哪里-任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

实际上,我最终从部分先前的链接中找到了答案。看起来所有导致错误的SQL文件在文件末尾都缺少GO流运算符-这似乎在每个EXECUTE命令之后都需要,甚至在文件末尾也是如此。