I am working with a stored procedure that inserts values in a table: an ID and the current Date. I know how to get the last used ID with SCOPE_IDENTITY but I also need to SELECT the Date that was just inserted. Any ideas?
ALTER PROCEDURE [dbo].[sp_InsertOrderHeader]
AS
BEGIN
SET NOCOUNT ON;
INSERT INTO OrderHeaders (OrderStateId,DateTime) VALUES (1,GETDATE());
SELECT CONVERT(int, SCOPE_IDENTITY()) Id
END