Creating the following Execution Plan returns an error: "Column 'XXXX' does not allow nulls".
DECLARE @Department varchar (50)
SET @Department = 'To je Department'
-- Primer prihoda v proceduro @Str1 -> 'A1, A2'
DECLARE @Str1 varchar (7000), @Str2 varchar (1000), @Int1 int, @Int2 int
SET @Str1 = @Department
SET @Str1 = @Str1 + ','
SET @Int1 = 0
SET @Int2 = charindex (',', @Str1, @Int1)
DROP TABLE #Tab
CREATE TABLE #Tab (Value varchar (100))
WHILE @Int2 - @Int1 > 0 BEGIN
SET @Str2 = substring (@Str1, @Int1, (@Int2 - @Int1))
SET @Int1 = @Int2 + 1
SET @Int2 = charindex (',', @Str1, @Int1)
INSERT INTO #Tab VALUES (ltrim (rtrim (@Str2)))
END
SELECT * from #Tab
N:B:No errors are returned with the same query if temporary table #Tab is replaced with an ordinary one.
Same query runs using MS SQL Management Studio.
WORKAROUND:
Use actual explain plan:
1. Press down the "Include actual execution plan for each statements" toggle button
2. Run your statements
3. Click execution plan tab to view the actual execution plan
STATUS:
Waiting for fix in a future release Toad for Sql Server.
© 2024 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy Cookie Preference Center