Skip to content

Commit 4561708

Browse files
recompiles and such
yay
1 parent 0d70c15 commit 4561708

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

sp_IndexCleanup/sp_IndexCleanup.sql

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
685685
)
686686
) AS a
687687
CROSS APPLY x.nodes(N'//i') AS t(c)
688-
WHERE LTRIM(RTRIM(c.value(N'(./text())[1]', N'sysname'))) <> N'';
688+
WHERE LTRIM(RTRIM(c.value(N'(./text())[1]', N'sysname'))) <> N''
689+
OPTION(RECOMPILE);
689690

690691
IF @debug = 1
691692
BEGIN
@@ -777,7 +778,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
777778
)
778779
) AS a
779780
CROSS APPLY x.nodes(N'//i') AS t(c)
780-
WHERE LTRIM(RTRIM(c.value(N'(./text())[1]', N'sysname'))) <> N'';
781+
WHERE LTRIM(RTRIM(c.value(N'(./text())[1]', N'sysname'))) <> N''
782+
OPTION(RECOMPILE);
781783

782784
IF @debug = 1
783785
BEGIN
@@ -805,7 +807,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
805807
1/0
806808
FROM #include_databases AS id
807809
WHERE id.database_name = ed.database_name
808-
);
810+
)
811+
OPTION(RECOMPILE);
809812

810813
/* If we found any conflicts, raise an error */
811814
IF LEN(@conflict_list) > 0

sp_QuickieStore/sp_QuickieStore.sql

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,7 @@ DECLARE
16821682
@requires_secondary_processing bit,
16831683
@split_sql nvarchar(MAX),
16841684
@error_msg nvarchar(2000),
1685-
@conflict_list nvarchar(max);
1685+
@conflict_list nvarchar(max) = N'';
16861686

16871687
/*
16881688
In cases where we are escaping @query_text_search and
@@ -1963,6 +1963,8 @@ BEGIN
19631963
BEGIN
19641964
INSERT
19651965
#include_databases
1966+
WITH
1967+
(TABLOCK)
19661968
(
19671969
database_name
19681970
)
@@ -1986,14 +1988,17 @@ BEGIN
19861988
)
19871989
) AS a
19881990
CROSS APPLY x.nodes(N'//i') AS t(c)
1989-
WHERE LTRIM(RTRIM(c.value(N'(./text())[1]', N'sysname'))) <> N'';
1991+
WHERE LTRIM(RTRIM(c.value(N'(./text())[1]', N'sysname'))) <> N''
1992+
OPTION(RECOMPILE);
19901993
END;
19911994

19921995
/* Parse @exclude_databases if specified using XML for compatibility */
19931996
IF @exclude_databases IS NOT NULL
19941997
BEGIN
19951998
INSERT
19961999
#exclude_databases
2000+
WITH
2001+
(TABLOCK)
19972002
(
19982003
database_name
19992004
)
@@ -2017,14 +2022,13 @@ BEGIN
20172022
)
20182023
) AS a
20192024
CROSS APPLY x.nodes(N'//i') AS t(c)
2020-
WHERE LTRIM(RTRIM(c.value(N'(./text())[1]', N'sysname'))) <> N'';
2025+
WHERE LTRIM(RTRIM(c.value(N'(./text())[1]', N'sysname'))) <> N''
2026+
OPTION(RECOMPILE);
20212027

20222028
/* Check for databases in both include and exclude lists */
20232029
IF @include_databases IS NOT NULL
20242030
BEGIN
2025-
/* Build list of conflicting databases */
2026-
SET @conflict_list = N'';
2027-
2031+
/* Build list of conflicting databases */
20282032
SELECT
20292033
@conflict_list =
20302034
@conflict_list +
@@ -2036,7 +2040,8 @@ BEGIN
20362040
1/0
20372041
FROM #include_databases AS id
20382042
WHERE id.database_name = ed.database_name
2039-
);
2043+
)
2044+
OPTION(RECOMPILE);
20402045

20412046
/* If we found any conflicts, raise an error */
20422047
IF LEN(@conflict_list) > 0

0 commit comments

Comments
 (0)