Wednesday, 11 December 2013

PROD Script





SET IDENTITY_INSERT [dbo].[XYZ] ON

IF NOT EXISTS(SELECT 1 FROM [dbo].[XYZ] WHERE [Id] =28)

INSERT [dbo].[XYZ] ([Id], [first_Name],[last_Name] ) VALUES (28, 'CUSTOM','CUSTOM')

SET IDENTITY_INSERT [dbo].[XYZ] OFF

 

 

 

SET IDENTITY_INSERT [dbo].[ABC] ON

IF NOT EXISTS(SELECT 1 FROM [dbo].[ABCC] WHERE [Id] =274)

INSERT [dbo].[TableName] ([Id], [Id],[Vendor],[Name],[Short] ) VALUES (274,28, 'CUSTOM','CUSTOM','CUSTOM')

SET IDENTITY_INSERT [dbo].[ABC] OFF

 

 

UPDATE ZZZ_table
SET [Id]=274
WHERE code like 'CUST%'




-----------------------------------------------------------------------


**************
UPDATE SCRIPT:
**************




IF(@MachineName = 'LA-SONY-1') --Server Name





BEGIN


IF (SELECT COUNT(*) FROM [SSISConfigurations]

WHERE [ConfigurationFilter] = 'SSISPackageName'

AND [PackagePath] = '\Package.Variables[User::EmailSubject].Properties[Value]') = 0

BEGIN

INSERT [dbo].[SSISConfigurations]


([ConfigurationFilter],

[ConfiguredValue],

[PackagePath],

[ConfiguredValueType])

VALUES


(N'SSISPackageName',

N'DEV - New Data file has been loaded',

N'\Package.Variables[User::EmailSubject].Properties[Value]',

N'String')


END


ELSE


BEGIN


IF NOT EXISTS(SELECT ConfiguredValue from SSISConfigurations

WHERE [ConfigurationFilter] = 'SSISPackageName'

AND [PackagePath] = '\Package.Variables[User::EmailSubject].Properties[Value]'

AND ConfiguredValue = 'DEV - New Data file has been loaded')


BEGIN


UPDATE [dbo].[SSISConfigurations]

SET [ConfiguredValue] = N'DEV - New Data file has been loaded'

WHERE [ConfigurationFilter] = 'SSISPackageName'

AND [PackagePath] = '\Package.Variables[User::EmailSubject].Properties[Value]'

END


END




END