Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2014
    Posts
    7

    Red face Unanswered: How to get all the users and tables from microsoft sql server

    Hi,

    1. I just want to list down all the users from microsoft sql server
    2. I just want to list down all the tables from microsoft sql server

    Could you please give me the exact query?

    I am very new to microsoft sql

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Do you mean all tables and users from a database in MS SQL Server?

    - For the tables:
    Code:
    USE [DatabaseName]
    GO
    SELECT name FROM sys.objects WHERE type = 'U';
    Or:
    Code:
    SELECT name FROM [DatabaseName].sys.objects WHERE type = 'U';
    - For the Users:
    Code:
    USE [DatabaseName]
    GO
    SELECT name from sys.syslogins;
    Or:
    Code:
    SELECT name FROM [DatabaseName].sys.syslogins;
    Where DatabaseName is the name of the concerned database.
    Have a nice day!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •