2015-04-23 40 views
2

我有下面的语句在工作中AX:如何查看X ++ select语句的SQL表达式?

select RecId from pjiTable 
    join pID, Type, PrId from sjTable 
    where pjiTable.Prid == sjTable.PrId && 
     (sjTable.Type == PjType::TimeMaterial || sjTable.Type == PjType::FixedPrice); 

我在SQL Server中使用它。我如何将此select语句转换为SQL并在SQL Server Management Studio中使用它?

回答

4

为了调试的目的,你可以改变你的select查询和你的桌子上使用getSQLStatement方法:

select generateOnly forceLiterals RecId from pjiTable 
    join pID, Type, PrId from sjTable 
    where pjiTable.Prid == sjTable.PrId && 
     (sjTable.Type == PjType::TimeMaterial || sjTable.Type == PjType::FixedPrice);  
info(pjiTable.getSQLStatement()); 

这将显示你的SQL语句无需实际执行该语句。

+2

您还可以添加'forceLiterals'来查看精确值而不是参数。 https://msdn.microsoft.com/en-us/library/aa656402.aspx – Matej

+1

另请参阅http://stackoverflow.com/a/33927010/4509 –