Avatar of bfuchs
Flag for United States of America

asked on 

Getting diff results from same view.

Hi Experts,

2- I have a view on my DB which consists of the following
SELECT     dbo.Initialstbl.LastName, dbo.Initialstbl.FirstName, sys.sysprocesses.blocked, sys.sysprocesses.waittype, sys.sysprocesses.waittime
FROM         sys.sysprocesses INNER JOIN
                      dbo.Initialstbl ON sys.sysprocesses.net_address = REPLACE(dbo.Initialstbl.SQLName, ':', '')

Open in new window

When I run it in SSMS I see many records, while when I link that view to my Access app I only see a few, why is that?

2- How can I have the following as a view?

use master
SELECT p.spid, p.blocked, r.blocking_session_id,I.LastName, I.FirstName, DB_NAME(p.dbid) dbname, p.loginame, p.login_time, p.last_batch, p.status, p.hostname, p.program_name, p.hostprocess, c.client_net_address, t.text, p.net_address
FROM master.sys.sysprocesses p
	INNER JOIN master.sys.dm_exec_connections c ON p.spid=c.session_id
	INNER JOIN PlacementNP.dbo.Initialstbl I ON p.net_address = REPLACE(I.SQLName, ':', '')
	LEFT JOIN master.sys.dm_exec_requests r ON p.spid=r.session_id
	CROSS APPLY master.sys.dm_exec_sql_text(c.most_recent_sql_handle) AS t

Open in new window

Thanks in Advance.
DatabasesMicrosoft AccessMicrosoft SQL ServerSQL

Avatar of undefined
Last Comment

8/22/2022 - Mon