How to find who created tables in Azure SQL Database ?

Avula, Mallikarjuna 0 Reputation points
2023-05-24T16:49:09.42+00:00

Could you please someone help me with the queries who created tables in my Azure SQL Datbase.

I have tried most of the ways like sp_tables, sys.tables etc. That would be great if someone help me asap.

Thanks in Advance.

Mallikarjuna A

Azure SQL Database
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Alberto Morillo 34,671 Reputation points MVP Volunteer Moderator
    2023-05-24T18:15:23.3566667+00:00

    Reports that are available on SQL Server instances rely on traces that are not available on Azure SQL Database. Unfortunately, that means you cannot not know who created those tables unless you create a DDL Trigger, use extended events to capture them or enable Azure SQL Auditing on Azure SQL Database. Here I posted examples of how to start monitoring schema changes with Azure SQL.

    0 comments No comments

  2. GeethaThatipatri-MSFT 29,542 Reputation points Microsoft Employee Moderator
    2023-05-24T18:22:06.85+00:00

    @Avula, Mallikarjuna Welcome to the Microsoft Q&A forum, Thanks for posting your question.

    You get those details unless you enable auditing or you have created triggers to monitor the changes on the database manually, there is no way to trace them.

    in Auditing, it will capture all the changes that we are happening on the database (who did it, what is the IP, which login created it, at what time, and some other stuff..) and store them in the Storage account

    Once auditing is enabled, navigate to the storage account where the audit logs are stored. You can find this information in the auditing settings of your Azure SQL Database.

    https://learn.microsoft.com/en-us/azure/azure-sql/database/auditing-overview?view=azuresql

    In the same way, if we create a custom trigger, you can trace the changes which are happening on the DB along with the user name and IP and other stuff and store them in the temporary tables

    where users can monitor the changes which are happening in the database

    FYI

    SP_TABLES ---Returns a list of objects that can be queried in the database, it won't give the details on who created it.

    sys.tables ---- Returns a row for each user table in SQL Server and it won't give you the details on who created the table

    I hope this information helps

    Regards

    Geetha


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.