• Not a problem. Provide a variable, say the TFS version number or something, in the build command line and set the extended property for the database in a Post-Deployment script.

    Actually, when you're doing incremental deployments from DBPro, it does this for you, although since that's an internally generated number, I doubt it's available to you for documentation:

    IF (DB_ID(N'$(DatabaseName)') IS NOT NULL)

    BEGIN

    DECLARE @stampValue nvarchar(128),

    @stmt nvarchar(4000),

    @parm nvarchar(4000)

    SELECT @stmt = N'USE [$(DatabaseName)] SELECT @valueOUT = CAST(value as nvarchar(128)) FROM ::fn_listextendedproperty(''microsoft_database_tools_deploystamp'', null, null, null, null, null, null)',

    @parm = N'@valueOUT nvarchar(128) OUTPUT'

    EXEC sp_executesql @stmt, @parm, @valueOUT = @stampValue OUTPUT

    IF (@stampValue = CAST(N'c4b9a607-e198-4907-b0e0-edef35034203' AS nvarchar(128)))

    BEGIN

    RAISERROR(N'Deployment has been skipped because the script has already been deployed to the target server.', 16, 100) WITH NOWAIT

    RETURN

    END

    END

    GO

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning