''select [dd hh:mm:ss.mss],session_id,login_name,host_name,database_name,blocking_session_id,
blocked_session_count
from SERVERB.master.dbo.tbl_whoisactive where
collection_time >DATEADD(MINUTE, -3, getdate())'''') as a;
Message is given as
Unclosed quotation mark after the character string 'exec SERVERB.master.dbo.Sp_whoisactive
However; on removing last quote it is giving message as below.
OLE DB provider "MSOLEDBSQL" for linked server "(null)" returned message "Deferred prepare could not be completed.".
Msg 8180, Level 16, State 1, Line 1
Statement(s) could not be prepared.
Msg 102, Level 15, State 1, Line 11
Incorrect syntax near 'select [dd hh:mm:ss.mss],session_id,login_name,host_name,database_name,blocking_session_id,
blocked_session_count
from serverb'.
It's giving below message. Seems issue with temporary table.
Msg 11526, Level 16, State 1, Procedure sys.sp_describe_first_result_set, Line 1 [Batch Start Line 0]
The metadata could not be determined because statement 'INSERT #sessions
(
recursion,
session_id,
request_id,
session_number,
elapsed' in procedure 'sp_WhoIsActive' uses a temp table.
Hi, thanks for revert; still showing message as below.
Msg 11525, Level 16, State 1, Procedure sys.sp_describe_first_result_set, Line 1 [Batch Start Line 0]
The metadata could not be determined because statement 'INSERT INTO #sessions (
recursion,
session_id,' uses a temp table. Metadata discovery only supports temp tables when analyzing a single-statement batch.