I don’t know, is calling RECONFIGURE unnecessarily an issue? Anyway, if you really want to only enable the integration if it’s not already enabled (and maybe want to do something else at the same time):
DECLARE @config TABLE (
NAME sysname,
minimum INT,
maximum INT,
config_value INT,
run_value int
)
INSERT INTO @config
EXEC sp_configure 'clr enabled'
IF EXISTS (SELECT run_value FROM @config WHERE run_value = 0)
BEGIN
PRINT 'Enabling CLR integration'
EXEC sp_configure 'clr enabled', 1;
RECONFIGURE;
EXEC sp_configure 'clr enabled'
END
No comments:
Post a Comment