January 20, 2023 at 12:00 am
Comments posted to this topic are about the item Verifying Trees
January 20, 2023 at 8:52 am
Very interesting code indeed - thank you very much for this.
Some comments:
I consider this as a feature, since I cannot use @DDL to create a table using @DML to save the entries of ##tree to it.
January 21, 2023 at 11:12 pm
Hello Ruedifuchs,
Thank you for your comments.
Unless I've misunderstood comment 2) it is possible to SELECT statements in @DML that return results, eg.
DECLARE @ERROR_NUMBER INT
DECLARE @ERROR_MESSAGE VARCHAR(MAX)
DECLARE @ROW_COUNT INT
EXEC @ERROR_NUMBER =
dbo.sp_VerifyTree
@Schema = 'dbo', -- schema of table containing tree
@Graph = 'Graph', -- table containing tree
@NodeId = 'NodeId', -- column name for NodeId in table containing tree
@Node = 'Node', -- column name for Node in table containing tree
@ParentId = 'ParentId', -- column name for ParentId in table containing tree
@DDL = '', -- DDL code to execute first (optional)
@DML = '
SELECT * FROM ##Tree
', -- DML code to execute last (optional)
@ERROR_NUMBER = @ERROR_NUMBER OUTPUT,
@ERROR_MESSAGE = @ERROR_MESSAGE OUTPUT,
@ROW_COUNT = @ROW_COUNT OUTPUT
SELECT @ERROR_NUMBER AS ERROR_NUMBER, @ERROR_MESSAGE AS ERROR_MESSAGE, @ROW_COUNT AS ROW_COUNT
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy