0

What methods can I use to monitor updating data real-time ? Returned data from following stored procedure that write as string query :

BEGIN TRAN

USE [MyDataBase]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER procedure [dbo].[MySp]
(    
    @UserId INT
)
as
BEGIN

CREATE TABLE #tmp (T1 INT,T2 NVARCHAR(500))
declare @sql nvarchar(max)
SET @sql='select  [T1], [dbo].[MyFunction]('+ cast(@UserId as nvarchar(20))+',[T1],0) as [T2]
          from [dbo].[MyTable]               
          where ( [X] in(50,60) or [Y] in(520,530) ) and  [dbo].[MyFunction]('+ cast(@UserId as nvarchar(20)) +',[T1],0) <>0'

    sp_executesql @sql        
END

EDIT 1 :

The procedure non string query is :

BEGIN TRAN

USE [MyDataBase]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER procedure [dbo].[MySp]
(    
    @UserId INT
)
as
BEGIN

select  [T1], [dbo].[MyFunction]('+ cast(@UserId as nvarchar(20))+',[T1],0) as [T2]
          from [dbo].[MyTable]               
          where ( [X] in(50,60) or [Y] in(520,530) ) and  [dbo].[MyFunction]('+ cast(@UserId as nvarchar(20)) +',[T1],0) <> 0       
END

But also this method not correct working.What to do?

Mohsen
  • 231
  • 5
  • 17

1 Answers1

0

SQLDependency doesn't work with temporal tables.

Please see What are the limitations of SqlDependency

Community
  • 1
  • 1
Jesús López
  • 8,338
  • 7
  • 40
  • 66