Thursday, August 28, 2014

exec in Team City

you need to add exec - for example - a plain sp_rename wont work

TFS Woes

a changeset can have a reference to a file that has been renamed and will leave you in the dark that that has happened.

Wednesday, August 27, 2014

sql bracket woes

an example of nightmares in brackets:

IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[xx]') AND type in (N'U'))
drop table xx
go
create table x (x int)
EXEC sp_rename '[dbo].[x]', '[dbo].[xx]';
IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[[dbo]].[xx]]]') AND type in (N'U'))
EXEC sp_rename '[dbo].[[dbo]].[xx]]]', 'xx';

GO

sp_rename woes

do not include the scheam in the 2nd parameter!
keep "[" away from the name

Wednesday, August 20, 2014