ALTER PROCEDURE dbo.zz_sp_testing_inout
AS
WITH rows AS (SELECT *, row_number() OVER (ORDER BY emppin, trxdate) AS rownum
FROM rawtrx)
SELECT *, rowsMinusOne.trxtime AS trxtimeIN, ISNULL(rows.trxtime, 1) AS trxtimeOUT
FROM rows AS rowsMinusOne LEFT OUTER JOIN
rows ON rows.rownum = rowsMinusOne.rownum + 1 AND rows.emppin = rowsMinusOne.emppin
Okay, does that look more like a stored procedure?
well this works exactly the way I want it to work, it returns the records...I want to add the records returned by this code above to a table.
is that possible?