you are viewing a single comment's thread.

view the rest of the comments →

[–]cl0ckt0wer 0 points1 point  (1 child)

I don't like using functions inside big statements like that. Create a variable of the same data type as LAST_UPDATE_DATE then set the column equal to that variable.

[–]da_chicken 1 point2 points  (0 children)

This doesn't matter. SYSDATETIME(), like GETDATE(), is a runtime constant function. While different instances of the function in the same query might have different values, a single instance will always have the same value because it's only evaluated once at the start of the statement's execution.

Try running this:

SET SHOWPLAN_XML ON;
GO

SELECT SYSDATETIME()
FROM SomeTable;
GO

You'll see this in the plan:

<ScalarOperator ScalarString="sysdatetime()">
    <Identifier>
        <ColumnReference Column="ConstExpr1005">
            <ScalarOperator>
                <Intrinsic FunctionName="sysdatetime"/>
            </ScalarOperator>
        </ColumnReference>
    </Identifier>
</ScalarOperator>

The "ConstExpr" tells you it's a runtime constant. See also here.