Hi @Maksym Volkov ,
Welcome to Microsoft Q&A Platform. Thank you for posting query here.
The NEXT VALUE FOR function is a non-deterministic function, and is only allowed in contexts where the number of generated sequence values is well defined. There are a lot of limitations and restrictions with the use of the NEXT VALUE FOR. The NEXT VALUE FOR is not allowed to be used in check constraints, default objects, computed columns, views, user-defined functions, user-defined aggregates, user-defined table types, sub-queries, common table expressions, derived tables or return statements.
Solution/Work Around:
You can the query using lookup activity and then pass value to dataflow. Your data flow should be parameterized.
OR
To overcome the limitation of the use of NEXT VALUE FOR, you can create a view that returns NEXT VALUE for sequence object. Unfortunately, one of the other limitations of the use of NEXT VALUE FOR is that it is also not allowed to be used in a view. To overcome this limitation, the OPENROWSET rowset function can be used. The OPENROWSET is an alternative to accessing tables in a linked server.
CREATE VIEW [SchemaName].[SequenceName]
AS
SELECT *
FROM OPENROWSET('SQLNCLI', 'Server=<serverName>;Database=<DBName>;UID=<UserID>;Pwd=<Password>',
'SELECT NEXT VALUE FOR [schemaName].[SequenceName] AS [SequenceID]')
GO
Hope this will help. Please let us know if it works or any further queries. Thank you.