I have a sql stored procedure which consists of two parameters. And I need to set the current value of a Sequence as the default value of a one parameter. So when I added default value for the parameter it gives me following error.
Msg 102, Level 15, State 1, Procedure sp_GET_TransformationSummary, Line 8
Incorrect syntax near '('.
Msg 156, Level 15, State 1, Procedure sp_GET_TransformationSummary, Line 11
Incorrect syntax near the keyword 'AS'.
And here is my code..
ALTER PROCEDURE [dbo].[sp_GET_TransformationSummary]
@AreaCode AS NVARCHAR(MAX),
@SyncId AS INT = (SELECT CONVERT(INT, CURRENT_VALUE) FROM SYS.SEQUENCES WHERE name = 'SQ_COMMON')
AS
BEGIN
SET NOCOUNT ON;
SELECT * FROM TABLE_NAME
WHERE Area= @AreaCode AND SyncId = @SyncId;
END
And Is there any way to do this?
I need to have the CURRENT_VALUE of SQ_COMMON sequence as the default value.