• Even if you hadn't added the constraint to the table, the second program would still fail because there would already be the temp table from the first program.

    I wrote a small bit on my blog about what goes on in tempdb as regards temporary object names, which kind of touches on why you can have multiple table variables of the same name, but not multiple temp tables.

    http://sqlmunkee.blogspot.com/2011/09/temporary-variable-couple-of-points.html

    [font="Courier New"]sqlmunkee[/font]
    [font="Courier New"]Bringing joy and happiness via SQL Server since 1998[/font]