
DECLARE @scriptName VARCHAR(255) = 'Suggested Order Export'

IF EXISTS(SELECT 1 FROM [dbo].[tbXSLTManager] WHERE Name = @scriptName)
BEGIN

	DECLARE @XsltManagerId INT 
	
	SELECT @XsltManagerId = XSLTManagerId FROM [dbo].[tbXSLTManager] WITH(NOLOCK)
	WHERE Name = @scriptName
	
	UPDATE [dbo].[tbXSLTManagerScripts]
	SET Script =
	'<?xml version="1.0"?>
<xsl:stylesheet     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     version="1.0">
	<xsl:output omit-xml-declaration="no" indent="yes"/>
	<xsl:strip-space elements="*"/>
	<xsl:template match="node()|@*">
		<xsl:copy>
			<xsl:apply-templates select="node()|@*"/>
		</xsl:copy>
	</xsl:template>
	<xsl:template match="*[@xsi:nil = 'true']" />
	<xsl:template match="DistributorInvoiceNumber[not(node())]"/>
</xsl:stylesheet>'
	WHERE XsltManagerID = @XsltManagerId		
END
GO
