June 27, 2011 at 7:26 am
This is what I'm trying to do:
Delete t
From TableT t
Output Deleted.TableTID,
Deleted.Value1,
Deleted.Value2
Into TableTArchive
(
TableTID,
Value1,
Value2
)
Left Outer Join TableX x On x.TableTID = t.TableTID
Where x.TableXID IS NULL
But it's throwing me an error for TableT's alias...how can I do a table alias name with an output clause?
TIA
June 27, 2011 at 7:30 am
pure syntax issue...the OUTPUT...INTO goes BEFORE the FROM:
Delete t
Output Deleted.TableTID,
Deleted.Value1,
Deleted.Value2
Into TableTArchive
(
TableTID,
Value1,
Value2
)
From TableT t
Left Outer Join TableX x On x.TableTID = t.TableTID
Where x.TableXID IS NULL
Lowell
June 27, 2011 at 7:34 am
That's weird Lowell (thanks by the way). I have an entire archive job that is currently running with the exact same syntax as my original post, but without the table alias...apparently SQL Server doesn't care when there's no table alias.
Thanks again!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply