Zoomed Image

AMSX Scripting Language - Command : sqlstatement.addcte

Summary

Wrap a SQL statement variable in a Common Table Expression

Description

Adds a WITH clause (Common Table Expression) to the SQL statement variable. The CTE is prepended so the main query can reference it. Use this when you need to factor out a subquery for clarity or reuse within the same statement.

Parameters

ParameterDescription
cmdSQL statement variable name
Argument 0CTE SQL text to prepend

Syntax


SqlStatement.AddCTE "SQL statement variable name", "CTE SQL text to prepend"

Return to the AMSX Command Reference