Wednesday, June 22, 2016

All User on other server

SELECT *
FROM OPENROWSET
(
  'SQLNCLI',
--Server information, Username & Password here
  'Server=10.5.6.102;UID=prince;PWD=123;',
  'SELECT name, type_desc FROM sys.server_principals
WHERE TYPE IN (''U'', ''S'', ''G'') and name not like ''%##%''
ORDER BY name, type_desc;'
)

No comments:

Post a Comment