BUG: IF condition backward for sp_rename !!
Here's an entire deployment script. Can you spot the bug?
SET NUMERICROUNDABORT OFF
GO
SET ANSIPADDING, ANSIWARNINGS, CONCATNULLYIELDSNULL, ARITHABORT, QUOTEDIDENTIFIER, ANSINULLS ON
GO
USE [MVSDB]
GO
PRINT N'Altering [dbo].[Shift]'
GO
IF (COLLENGTH(N'[dbo].[Shift]', N'ShiftDefinitionId') IS NOT NULL) AND (COLLENGTH(N'[dbo].[Shift]', N'ShiftConfigurationId') IS NULL)
EXEC sprename N'[dbo].[Shift].[ShiftConfigurationId]', N'ShiftDefinitionId', 'COLUMN'
GO
PRINT N'Adding foreign keys to [dbo].[Shift]'
GO
IF NOT EXISTS (SELECT 1 FROM sys.foreignkeys WHERE objectid = OBJECTID(N'[dbo].[FKShiftShiftDefinition]', 'F') AND parentobjectid = OBJECTID(N'[dbo].[Shift]', 'U'))
ALTER TABLE [dbo].[Shift] ADD CONSTRAINT [FKShiftShiftDefinition] FOREIGN KEY ([ShiftDefinitionId]) REFERENCES [dbo].[ShiftDefinition] ([Id])
GO
The "IS NULL" and "IS NOT NULL" tests are reversed! Frankly, I find this absolutely amazing.
Please fix this ridiculous bug.

This was fixed in version 10.0.0.179
-
Thanks for reporting this. We have implemented a fix. Please visit Check for Updates in the tool, and download build 179. Could you confirm that this issue is fixed for you? Thanks, and apologies!