-2

I wonder if there is a way in SQL Server Management Studio to see the queries in T-SQL that have been executed in that background when we create or edit something using only the graphical interface .

For example if I click create database using the graphical interface, I want to see the code that have been executed to create the database, etc..

I tried to search but I didn't find anything

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Karim El
  • 3
  • 3
  • 2
    You can use the [profiler](https://www.mssqltips.com/sqlservertutorial/3502/how-to-launch-a-sql-server-profiler-session/) to see queries executed from an application. You can [script an existing table as CREATE](https://learn.microsoft.com/en-us/sql/ssms/scripting/generate-scripts-sql-server-management-studio?view=sql-server-ver16). – Olivier Jacot-Descombes Nov 20 '22 at 15:21

1 Answers1

3

Most SSMS wizards have a "Script" button that will generate a script instead of performing the change directly.

enter image description here

Of course you can also use Profiler to capture all the traffic from a client, but it's not necessary to create scripts for common operations.

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67