TFS2018 构建定义保存错误 - 名称为 %counterName="BuildFolderId";% 的计数器不存在
TFS2018 Build definition save error - Counter with name %counterName="BuildFolderId";% does not exist
我对从 2015update1 到 2018update2 新迁移的 TFS On-permise 有问题
我创建了一个新的构建定义,当我单击 "save" 时,我收到以下消息:
%error="800095";%:TFSSERVER.Tfs_DefaultCollection.dbo.prc_iCounterGetNext: Counter with name %counterName="BuildFolderId";% does not exist
%error="901004";%:TFSSERVER.Tfs_DefaultCollection.prc_iiEnsureFolder: Database Update Failure - Error %error="800095";% executing EXEC statement for prc_iCounterGetNext
%error="901004";%:TFSSERVER.Tfs_DefaultCollection.prc_AddDefinition: Database Update Failure - Error %error="901004";% executing EXEC statement for Build.prc_iiEnsureFolder
它与
developer community
已通过对 sql 中给定的数据库执行查询来解决
TFS2017Update1 release note - known issues:
INSERT tbl_Counter (PartitionId, DataspaceId, CounterName, CounterValue)
SELECT DISTINCT
dpm.PartitionId,
ds.DataspaceId,
N'TaskReferenceId',
1
FROM tbl_DatabasePartitionMap dpm
INNER LOOP JOIN Task.tbl_Hub h
ON h.PartitionId = dpm.PartitionId
INNER LOOP JOIN tbl_Dataspace ds
ON ds.PartitionId = dpm.PartitionId
AND ds.DataspaceCategory = h.DataspaceCategory
AND ds.DataspaceIdentifier <> '00000000-0000-0000-0000-000000000000'
WHERE dpm.PartitionId > 0
AND dpm.HostType = 4
AND NOT EXISTS (
SELECT *
FROM tbl_Counter c
WHERE c.PartitionId = dpm.PartitionId
AND c.DataspaceId = ds.DataspaceId
AND c.CounterName = N'TaskReferenceId'
)
感谢您的帮助。
我终于找到了解决这个问题的方法
如何知道正确的DataspaceId:
SELECT TOP 1000 [PartitionId] ,[ProjectId],[DataspaceId],
[ProjectUri],ProjectName],[SequenceId],[IsDeleted],
[IsResolutionStateCustomized],[IsFailureTypeCustomized],[MigrationState],
[MigrationError] FROM [Tfs_DefaultCollection].[dbo].[tbl_Project]
WHERE
ProjectName = "My project witch having an error"
列 [ProjectUri]
中字符串的末尾包含项目的唯一 ID(在我的例子中 vstfs:///Classification/TeamProject/b96fbc5b-7bf3-452b-894f-6f5b4bb801c0
)
如何知道对应的DataspaceId
SELECT TOP 1000 [PartitionId]
,[DataspaceCategory]
,[DataspaceIdentifier]
,[DataspaceId]
,[DatabaseId]
,[State]
FROM [Tfs_DefaultCollection].[dbo].[tbl_Dataspace]
where DataspaceIdentifier="b96fbc5b-7bf3-452b-894f-6f5b4bb801c0"
and DataspaceCategory="Build"
它给了我我的数据空间 ID:726
查看table[Build]中是否没有记录。[tbl_Folder]
SELECT TOP 1000 [PartitionId]
,[DataspaceId]
,[FolderId]
,[FolderPath]
,[FolderName]
,[CreatedBy]
,[CreatedOn]
,[Description]
,[ChangedBy]
,[ChangedOn]
,[Deleted]
FROM [Tfs_DefaultCollection].[Build].[tbl_Folder]
WHERE DataspaceId=726
如果没有记录,我必须创建一个。
INSERT INTO [Build].[tbl_Folder]
([PartitionId]
,[DataspaceId]
,[FolderId]
,[FolderPath]
,[FolderName]
,[CreatedBy]
,[CreatedOn]
,[Description]
,[ChangedBy]
,[ChangedOn]
,[Deleted])
VALUES
(1
,726
,1
,''
,'\'
,'00000000-0000-0000-0000-000000000000'
,CURRENT_TIMESTAMP
,NULL
,NULL
,NULL
,0)
GO
检查table[tbl_Counter]中是否没有这个DataspaceId
的记录
SELECT TOP 1000 [PartitionId],[DataspaceId],[CounterName],[CounterValue]
FROM [Tfs_DefaultCollection].[dbo].[tbl_Counter]
where CounterName='BuildFolderId' and DataspaceId=726
如果没有记录,我必须创建一个。
INSERT INTO [dbo].[tbl_Counter]
([PartitionId]
,[DataspaceId]
,[CounterName]
,[CounterValue])
VALUES
(1
,726
,'BuildFolderId'
,2)
GO
之后,我可以保存我的构建定义。
当我尝试启动我的构建定义时出现其他错误:
%error="800095";%:TFSSERVER.Tfs_DefaultCollection.dbo.prc_iCounterGetNext: Counter with name %counterName="TimelineStringId";% does not exist
基于之前的脚本,我在 table [tbl_Counter]
中插入新值
INSERT INTO [dbo].[tbl_Counter]
([PartitionId]
,[DataspaceId]
,[CounterName]
,[CounterValue])
VALUES
(1
,726
,'TimelineStringId'
,2)
GO
最后我还有一个错误:
%error="800095";%:TFSSERVER.Tfs_DefaultCollection.dbo.prc_iCounterGetNext: Counter with name %counterName="TaskOrchestrationPlanId";% does not exist
所以:
INSERT INTO [dbo].[tbl_Counter]
([PartitionId]
,[DataspaceId]
,[CounterName]
,[CounterValue])
VALUES
(1
,726
,'TaskOrchestrationPlanId'
,2)
GO
我终于能够成功启动我的构建定义。
希望对某人有所帮助。
我写了一个 sql 脚本,分为两个版本,一个用于 TFS2018,另一个用于 TFS2015
将变量@projectName 更改为您的真实项目名称。
TFS2018版本:
USE [Tfs_DefaultCollection]
GO
declare @projectUriGlobal varchar(max);
declare @projectName varchar(max);
declare @DataspaceIdentifier varchar(max);
declare @DataspaceId int;
select @projectName='MyProjectName'
select @projectUriGlobal = (select [ProjectUri] from [tbl_Project] where ProjectName=@projectName)
select @DataspaceIdentifier = (select right(@projectUriGlobal, charindex('/', reverse(@projectUriGlobal) + '/') - 1))
if not exists(select DataspaceId from [tbl_Dataspace] where DataspaceIdentifier = @DataspaceIdentifier and DataspaceCategory='Build')
BEGIN
PRINT 'Création d" un enregistrement dans [tbl_Dataspace] pour le DataspaceIdentifier '+@DataspaceIdentifier;
INSERT INTO [tbl_Dataspace] VALUES (1,'Build', @DataspaceIdentifier,1,1)
END
select @DataspaceId = (select DataspaceId from [tbl_Dataspace] where DataspaceIdentifier = @DataspaceIdentifier and DataspaceCategory='Build')
PRINT 'Project Name : '+@projectName;
PRINT 'Project Uri :'+ @projectUriGlobal
PRINT 'DataspaceIdentifier : '+ @DataspaceIdentifier
PRINT 'DataSpaceID : '+ CAST(@DataspaceId as varchar)
if EXISTS(SELECT TOP 1 [DataspaceId] FROM [Build].[tbl_Folder] where DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans [Build].[tbl_Folder] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' car existe déjà'
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [Build].[tbl_Folder] pour le dataspace ID '+ CAST(@DataspaceId as varchar)
INSERT INTO [Build].[tbl_Folder] ([PartitionId] ,[DataspaceId],[FolderId],[FolderPath],[FolderName],[CreatedBy],[CreatedOn],[Description],[ChangedBy],[ChangedOn],[Deleted])
VALUES (1,@DataspaceId,1,'','\','00000000-0000-0000-0000-000000000000',CURRENT_TIMESTAMP,NULL ,NULL,NULL,0)
END
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='BuildFolderId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=BuildFolderId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=BuildFolderId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'BuildFolderId',2)
END
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='TimelineStringId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TimelineStringId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TimelineStringId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'TimelineStringId',2)
END
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='TaskOrchestrationPlanId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TaskOrchestrationPlanId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TaskOrchestrationPlanId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'TaskOrchestrationPlanId',2)
END
TFS2015 的版本为
USE [Tfs_DefaultCollection]
GO
declare @projectUriGlobal varchar(max);
declare @projectName varchar(max);
declare @DataspaceIdentifier varchar(max);
declare @DataspaceId int;
select @projectName='MyProjectName'
select @projectUriGlobal = (select [ProjectUri] from [tbl_Project] where ProjectName=@projectName)
select @DataspaceIdentifier = (select right(@projectUriGlobal, charindex('/', reverse(@projectUriGlobal) + '/') - 1))
if not exists(select DataspaceId from [tbl_Dataspace] where DataspaceIdentifier = @DataspaceIdentifier and DataspaceCategory='Build')
BEGIN
PRINT 'Création d" un enregistrement dans [tbl_Dataspace] pour le DataspaceIdentifier '+@DataspaceIdentifier;
INSERT INTO [tbl_Dataspace] VALUES (1,'Build', @DataspaceIdentifier,1,1)
END
select @DataspaceId = (select DataspaceId from [tbl_Dataspace] where DataspaceIdentifier = @DataspaceIdentifier and DataspaceCategory='Build')
PRINT 'Project Name : '+@projectName;
PRINT 'Project Uri :'+ @projectUriGlobal
PRINT 'DataspaceIdentifier : '+ @DataspaceIdentifier
PRINT 'DataSpaceID : '+ CAST(@DataspaceId as varchar)
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='BuildFolderId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=BuildFolderId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=BuildFolderId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'BuildFolderId',2)
END
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='TimelineStringId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TimelineStringId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TimelineStringId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'TimelineStringId',2)
END
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='TaskOrchestrationPlanId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TaskOrchestrationPlanId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TaskOrchestrationPlanId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'TaskOrchestrationPlanId',2)
END
我对从 2015update1 到 2018update2 新迁移的 TFS On-permise 有问题
我创建了一个新的构建定义,当我单击 "save" 时,我收到以下消息:
%error="800095";%:TFSSERVER.Tfs_DefaultCollection.dbo.prc_iCounterGetNext: Counter with name %counterName="BuildFolderId";% does not exist
%error="901004";%:TFSSERVER.Tfs_DefaultCollection.prc_iiEnsureFolder: Database Update Failure - Error %error="800095";% executing EXEC statement for prc_iCounterGetNext
%error="901004";%:TFSSERVER.Tfs_DefaultCollection.prc_AddDefinition: Database Update Failure - Error %error="901004";% executing EXEC statement for Build.prc_iiEnsureFolder
它与 developer community 已通过对 sql 中给定的数据库执行查询来解决 TFS2017Update1 release note - known issues:
INSERT tbl_Counter (PartitionId, DataspaceId, CounterName, CounterValue)
SELECT DISTINCT
dpm.PartitionId,
ds.DataspaceId,
N'TaskReferenceId',
1
FROM tbl_DatabasePartitionMap dpm
INNER LOOP JOIN Task.tbl_Hub h
ON h.PartitionId = dpm.PartitionId
INNER LOOP JOIN tbl_Dataspace ds
ON ds.PartitionId = dpm.PartitionId
AND ds.DataspaceCategory = h.DataspaceCategory
AND ds.DataspaceIdentifier <> '00000000-0000-0000-0000-000000000000'
WHERE dpm.PartitionId > 0
AND dpm.HostType = 4
AND NOT EXISTS (
SELECT *
FROM tbl_Counter c
WHERE c.PartitionId = dpm.PartitionId
AND c.DataspaceId = ds.DataspaceId
AND c.CounterName = N'TaskReferenceId'
)
感谢您的帮助。
我终于找到了解决这个问题的方法
如何知道正确的DataspaceId:
SELECT TOP 1000 [PartitionId] ,[ProjectId],[DataspaceId], [ProjectUri],ProjectName],[SequenceId],[IsDeleted], [IsResolutionStateCustomized],[IsFailureTypeCustomized],[MigrationState], [MigrationError] FROM [Tfs_DefaultCollection].[dbo].[tbl_Project] WHERE ProjectName = "My project witch having an error"
列 [ProjectUri]
中字符串的末尾包含项目的唯一 ID(在我的例子中 vstfs:///Classification/TeamProject/b96fbc5b-7bf3-452b-894f-6f5b4bb801c0
)
如何知道对应的DataspaceId
SELECT TOP 1000 [PartitionId] ,[DataspaceCategory] ,[DataspaceIdentifier] ,[DataspaceId] ,[DatabaseId] ,[State] FROM [Tfs_DefaultCollection].[dbo].[tbl_Dataspace] where DataspaceIdentifier="b96fbc5b-7bf3-452b-894f-6f5b4bb801c0" and DataspaceCategory="Build"
它给了我我的数据空间 ID:726
查看table[Build]中是否没有记录。[tbl_Folder]
SELECT TOP 1000 [PartitionId] ,[DataspaceId] ,[FolderId] ,[FolderPath] ,[FolderName] ,[CreatedBy] ,[CreatedOn] ,[Description] ,[ChangedBy] ,[ChangedOn] ,[Deleted] FROM [Tfs_DefaultCollection].[Build].[tbl_Folder] WHERE DataspaceId=726
如果没有记录,我必须创建一个。
INSERT INTO [Build].[tbl_Folder]
([PartitionId]
,[DataspaceId]
,[FolderId]
,[FolderPath]
,[FolderName]
,[CreatedBy]
,[CreatedOn]
,[Description]
,[ChangedBy]
,[ChangedOn]
,[Deleted])
VALUES
(1
,726
,1
,''
,'\'
,'00000000-0000-0000-0000-000000000000'
,CURRENT_TIMESTAMP
,NULL
,NULL
,NULL
,0)
GO
检查table[tbl_Counter]中是否没有这个DataspaceId
的记录SELECT TOP 1000 [PartitionId],[DataspaceId],[CounterName],[CounterValue] FROM [Tfs_DefaultCollection].[dbo].[tbl_Counter] where CounterName='BuildFolderId' and DataspaceId=726
如果没有记录,我必须创建一个。
INSERT INTO [dbo].[tbl_Counter]
([PartitionId]
,[DataspaceId]
,[CounterName]
,[CounterValue])
VALUES
(1
,726
,'BuildFolderId'
,2)
GO
之后,我可以保存我的构建定义。
当我尝试启动我的构建定义时出现其他错误:
%error="800095";%:TFSSERVER.Tfs_DefaultCollection.dbo.prc_iCounterGetNext: Counter with name %counterName="TimelineStringId";% does not exist
基于之前的脚本,我在 table [tbl_Counter]
中插入新值INSERT INTO [dbo].[tbl_Counter]
([PartitionId]
,[DataspaceId]
,[CounterName]
,[CounterValue])
VALUES
(1
,726
,'TimelineStringId'
,2)
GO
最后我还有一个错误:
%error="800095";%:TFSSERVER.Tfs_DefaultCollection.dbo.prc_iCounterGetNext: Counter with name %counterName="TaskOrchestrationPlanId";% does not exist
所以:
INSERT INTO [dbo].[tbl_Counter]
([PartitionId]
,[DataspaceId]
,[CounterName]
,[CounterValue])
VALUES
(1
,726
,'TaskOrchestrationPlanId'
,2)
GO
我终于能够成功启动我的构建定义。
希望对某人有所帮助。
我写了一个 sql 脚本,分为两个版本,一个用于 TFS2018,另一个用于 TFS2015
将变量@projectName 更改为您的真实项目名称。
TFS2018版本:
USE [Tfs_DefaultCollection]
GO
declare @projectUriGlobal varchar(max);
declare @projectName varchar(max);
declare @DataspaceIdentifier varchar(max);
declare @DataspaceId int;
select @projectName='MyProjectName'
select @projectUriGlobal = (select [ProjectUri] from [tbl_Project] where ProjectName=@projectName)
select @DataspaceIdentifier = (select right(@projectUriGlobal, charindex('/', reverse(@projectUriGlobal) + '/') - 1))
if not exists(select DataspaceId from [tbl_Dataspace] where DataspaceIdentifier = @DataspaceIdentifier and DataspaceCategory='Build')
BEGIN
PRINT 'Création d" un enregistrement dans [tbl_Dataspace] pour le DataspaceIdentifier '+@DataspaceIdentifier;
INSERT INTO [tbl_Dataspace] VALUES (1,'Build', @DataspaceIdentifier,1,1)
END
select @DataspaceId = (select DataspaceId from [tbl_Dataspace] where DataspaceIdentifier = @DataspaceIdentifier and DataspaceCategory='Build')
PRINT 'Project Name : '+@projectName;
PRINT 'Project Uri :'+ @projectUriGlobal
PRINT 'DataspaceIdentifier : '+ @DataspaceIdentifier
PRINT 'DataSpaceID : '+ CAST(@DataspaceId as varchar)
if EXISTS(SELECT TOP 1 [DataspaceId] FROM [Build].[tbl_Folder] where DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans [Build].[tbl_Folder] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' car existe déjà'
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [Build].[tbl_Folder] pour le dataspace ID '+ CAST(@DataspaceId as varchar)
INSERT INTO [Build].[tbl_Folder] ([PartitionId] ,[DataspaceId],[FolderId],[FolderPath],[FolderName],[CreatedBy],[CreatedOn],[Description],[ChangedBy],[ChangedOn],[Deleted])
VALUES (1,@DataspaceId,1,'','\','00000000-0000-0000-0000-000000000000',CURRENT_TIMESTAMP,NULL ,NULL,NULL,0)
END
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='BuildFolderId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=BuildFolderId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=BuildFolderId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'BuildFolderId',2)
END
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='TimelineStringId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TimelineStringId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TimelineStringId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'TimelineStringId',2)
END
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='TaskOrchestrationPlanId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TaskOrchestrationPlanId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TaskOrchestrationPlanId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'TaskOrchestrationPlanId',2)
END
TFS2015 的版本为
USE [Tfs_DefaultCollection]
GO
declare @projectUriGlobal varchar(max);
declare @projectName varchar(max);
declare @DataspaceIdentifier varchar(max);
declare @DataspaceId int;
select @projectName='MyProjectName'
select @projectUriGlobal = (select [ProjectUri] from [tbl_Project] where ProjectName=@projectName)
select @DataspaceIdentifier = (select right(@projectUriGlobal, charindex('/', reverse(@projectUriGlobal) + '/') - 1))
if not exists(select DataspaceId from [tbl_Dataspace] where DataspaceIdentifier = @DataspaceIdentifier and DataspaceCategory='Build')
BEGIN
PRINT 'Création d" un enregistrement dans [tbl_Dataspace] pour le DataspaceIdentifier '+@DataspaceIdentifier;
INSERT INTO [tbl_Dataspace] VALUES (1,'Build', @DataspaceIdentifier,1,1)
END
select @DataspaceId = (select DataspaceId from [tbl_Dataspace] where DataspaceIdentifier = @DataspaceIdentifier and DataspaceCategory='Build')
PRINT 'Project Name : '+@projectName;
PRINT 'Project Uri :'+ @projectUriGlobal
PRINT 'DataspaceIdentifier : '+ @DataspaceIdentifier
PRINT 'DataSpaceID : '+ CAST(@DataspaceId as varchar)
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='BuildFolderId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=BuildFolderId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=BuildFolderId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'BuildFolderId',2)
END
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='TimelineStringId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TimelineStringId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TimelineStringId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'TimelineStringId',2)
END
if EXISTS(SELECT TOP 1 [PartitionId],[DataspaceId],[CounterName] FROM [tbl_Counter] where CounterName='TaskOrchestrationPlanId' and DataspaceId=@DataspaceId)
BEGIN
PRINT 'Pas d"enregistrement a creer dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TaskOrchestrationPlanId car existe déjà';
END
ELSE
BEGIN
PRINT 'Creation d"un enregistrement dans la table [tbl_Counter] pour le dataspace ID '+ CAST(@DataspaceId as varchar) +' avec le counterName=TaskOrchestrationPlanId';
INSERT INTO [dbo].[tbl_Counter] ([PartitionId],[DataspaceId],[CounterName],[CounterValue]) VALUES (1,@DataspaceId,'TaskOrchestrationPlanId',2)
END