I was looking into creating a nested set for a hierarchical structure to create a categories table for a web site on an MSSQL 2008 express database. I have been following this guide which was written for MySQL: http://mikehillyer.com/articles/managing-hierarchical-data-in-mysql/ and was wondering what the MSSQL version of the REPEAT function in the following statement is:
SELECT CONCAT( REPEAT( ' ', (COUNT(parent.name) - 1) ), node.name) AS name
FROM nested_category AS node,
nested_category AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
GROUP BY node.name
ORDER BY node.lft;
Thanks in advance
I believe you’re looking for
REPLICATE: