Sunday, February 19, 2012

CTE with multiple update statements?

HI Gurus

I have written one CTE (common table expression) and trying to use same CTE with three seperate UPDATE statements which gives me error saying "Invalid Object name" (it works fine when I try to use with 1 update statement (any one from three update statements)


Isnt it possible that I can use 1 CTE with mutiple update statements?

waiting for your reply....

A CTE can be used multiple times in a single statement but not in multiple statements. You would need a table variable or temporary table if you will have multiple references.

More CTE documentation in BOL here: http://msdn2.microsoft.com/en-us/library/ms175972.aspx

|||thanx for your reply

No comments:

Post a Comment