Query: VersionLink Queries

1) Select Environment, count(*) from VersionLink Group by Environment

2) Select Environment, count(*) from VersionLink where not Environment = 'Your Environment' Group by Environment

3) Select * from VersionLink where not Environment = '@Environment@'

4) Delete from VersionLink where not Environment = '@Environment@'

5) Select TableName, count(*) from VersionLink Group by TableName order by TableName

6) Select * from VersionLink where TableName = '@TableName@'

7) Delete from [VersionLink] where TableName = '@TableName@'

8) Select * from [Licence].[DeMaSy].[DBList] as [ResultDBList] where Not [DBId] in (Select DBId from [DeMaSy].[DeMaSy].[VersionLink] where [TableName] = '@TableName@') order by [ResultDBList].[LogicalName]

9) Select distinct [DBId] from [Licence].[DeMaSy].[DBList] as [ResultDBList] where Not [DBId] in
(Select [DBId] from [DeMaSy].[DeMaSy].[VersionLink] where [TableName] = '@TableName@') and Not [DBId] in (0)

10) Insert Into [VersionLink] ([DBId], [Environment], [TableName], [PhysicalLocation], [DestDBId], [DBType]) Select [DBId], '@Environment@', '@Table@', '@PhysicalLocation@', 0, @DBType@ from [Licence].[DeMaSy].[DBList] as [ResultDBList] where Not [DBId] in (Select DBId from [DeMaSy].[DeMaSy].[VersionLink] where TableName = '@TableName@') and not [DBId] = 0

11) Select * from [@TableName@] where [DBId] in (Select [DBId] from [Licence].[DeMaSy].[DBList] as [ResultDBList] where Not [DBId] in (Select [DBId] from [DeMaSy].[DeMaSy].[VersionLink] where TableName = '@TableName@'))