Search code examples
sql-serversybasesap-ase

Sybase equivalent of MSSQL OUTPUT INTO


I've tried googling around with no luck.

I am aware of Sybase's output ability into a file, but I am trying to find out if it can also output into another table after an update, much like MSSQL's:

UPDATE Table1
OUTPUT inserted.ID
INTO @TempOfIDs
WHERE ID IN (x,y,z)

If not, is there any Sybase trick to mimic this functionality?

Thanks!


Solution

  • There's two ways of doing this: either you run a SELECT query with the same WHERE-clause and pick up the current values of those columns (since you're looking for the new values after the update), or you use a trigger to capture these values -- though in that case you won't be able to put these values into a table variable.