What is The Role of Print ERD Command in SQL Database?

What is The Role of Print ERD Command in SQL Database?
3 min read
23 June 2023

Many different commands can be run on SQL Database like Print, Quit, and Drop Table. One of these commands is Print ERD which stops the execution of queries for a database instance and prints them to the screen. That is useful when you want to stop your data from being changed during a process like a DROP TABLE, in which case it would be better to see the query before running it.

Print ERD can be beneficial in keeping your data from being corrupted because of running Data Manipulation Language (DML) statements. These statements include Update, Delete and Insert statements. If you have several of these running simultaneously, you will want to know beforehand what they are doing. That is the purpose of the ERD command, and it gives a report or an error-free file of what has been done so far by all DML queries running on a database instance.

Things That Print ERD Can Do

  1. It can print the query plan of the DML statements running on a database instance.
  1. It can print the status of each statement run on a database instance. That includes:

- The status of the data agent acting as a repository for data and its response time (written in centiseconds).

- The status of any query sent to the specified data repository.

- The status of all other stored procedures currently running on this instance, if any are used for DML statements.

  1. It can print the specific query processed on a database instance.
  1. It can print the status of any stored procedures currently running on this instance, if any are used for DML statements, and if they refer to the same tables as the DML statement being processed or to data in views referenced by these tables.
  1. It can print the name of any enabled trace flags that are in effect, if any.

How to Print ERD on SQL Database?

  1. To print ERD, you must be logged on as a user with access to the SQL Database instance or schema.
  1. If you are on SQL Database Management Studio, then go to Tools >> Options >> Security >> Create New Security Accounts.
  1. You can now create a new Security Account.
  1. You will need to provide a password for this account.
  1. Click OK, leave the Security Account Name as it is, and click Close.
  1. Now, go to a SQL Query window of the database you would like to Print ERD from, like in the SQL Server Management Studio scenario above, and right-click on the query you would like to print ERD for and select "Print as" on the menu that appears.
  1. You will now see a new window with the SQL ERD command.
  1. Enter your credentials and click OK.

Conclusion:

Print ERD is a valuable feature that can be used to see what type of queries are running on your SQL Database. It will also let you know if any other data is being deleted or modified in the database while running the DROP TABLE command, for instance.

In case you have found a mistake in the text, please send a message to the author by selecting the mistake and pressing Ctrl-Enter.
Author 3
Joined: 9 months ago
Comments (0)

    No comments yet

You must be logged in to comment.

Sign In / Sign Up