Show executed query in Microsoft SQL Server 2016 - ssms

In MySQL Workbench, after editing a column, table, or whatever, it will show the query for that action.
I could not find a similar feature in SQL Server 2016. I just want to view the SQL for the action I perform, such as editing a column.
Is it possible?

Something I've always set is Auto generate change scripts which can be found within the options:
This shows the script and prompts you to save it.
If I don't want it so that every time I do a change it prompts me I use the Generate Change Script icon (first icon below):
This is usually greyed out until you make a modification then you can click it. However the annoying thing is you have to click the icon to generate the script prior to saving the modification.
Downloaded SSMS 2016
The icon has slightly changed. In 2016 this is what you are looking for:
You will want to use the first icon on the toolbar above.
There is also a menu that appears called Table Designer. From there you can also generate the change script. This isn't a new feature in 2016 it was something I noticed when looking for the icon.

Related

How do i change the SQL Server Management Studio View Disgner Auto Formatting?

if you're working with Views and SQL Server Management Studio (i'm using version 14)
then you probably have noticed it, the code you put in the view designer gets auto formatted
i personally think that the way of formatting is really ugly, especially that JOIN statements are always at the end of the line. however, i'd like to change that.
i already looked a bit up and i know we can install custom formatters, but they only work for sql files (like new queries) but that won't overwrite the default behaviour of the view designer
can anyone help me find a solution? i don't care whether it is downloading a tool or it would be already helpful if i could at least stop the auto formatting somehow so i can at least apply my own code style and then it's the same for everyone in the team
i highly hope you know any kind of approach here.
thank you!
You cannot change the formatting being applied for DESIGN. Even in the new version of SSMS, I see that the code is formatted little differently in view designer. Even if you change through designer and save it and open it again, it is not keeping formatting changes and applies its formatting changes, when you open it again through View Designer.
You can try the below approach:
Right click the view and open in new window
Now, you can apply formatting manually or you can any of the SQL formatting tools or corresponding SSMS add-on to formatting to the code. Now, the formatting will be kept intact if you open it again. Sql formatting tools

SSMS SQL editor tool bar grayed out

I posted this earlier and obviously the person who marked it as duplicate did not read the post because the answer told me to do exactly what I said I was doing that does not work.
New install of SQL Server 2017 Express with existing databases. Login as sa or as a database owner. When you right click a table - Edit top 200 rows - open the SQL panel. The entire SQL editor toolbar is grayed out. I can copy the same SQL expression into a new query and the bar is active. I can execute the expression with Ctrl R when the bar is grayed out.
I have looked at dozens of posts but have not found the solution.
FYI Yes, I can write the SQL statement to update the table but it is faster, easier and safer to update it directly when you only have to change one number in a single row/column and I can update the data even with the tool bar grayed out.
Thank you to the one who has the solution.
I had the same problem. Tried many different things. Toolbar remained greyed out. Then looked at the shortcut for Execute by hovering over it and saw it was Alt X, ran the query using Alt X, the toolbar then became active, have no idea why. Note: Now the toolbar is active, the shortcut to Execute the query is now F5. (Alt X also still works).

SQL Server 2016 Management Studio doesn't keep line numbers

I can't get SQL Server 2016 Management Studio to remember that I want line numbers. Every time I open an instance, I have to turn line numbers on, but when I open a new instance, they've been turned off again.
Does anyone know how to make them stay on permanently or whether this is a bug within SSMS?
Even though the answer to this question was already given, i was looking for how to put line numbers on the editor and the answer was not given, so here it is!
Step1: Go to Tools > Options.
Step2: In the Options dialog box navigate to Text Editor >
Transact-SQL > General.
Step 3: Check “Line Numbers” and click on “OK” Now, when a query
window is opened Line Numbers will be displayed

Remain in "SQL Mode" in Access?

Right now, if I want to enter SQL queries in Microsoft Access, I do this:
Click the Create tab, then Query design button, then close the popup. Click the SQL button. Type my query. Click Run.
For my next query, I have to do that all over again. How can I stay in an SQL environment in Access?
Newer versions of Access still support many of the same keyboard shortcuts for the old Menu commands (in addition to the newer, longer keyboard shortcuts for the Ribbon interface). So, in the Access 2010 query designer I still use:
Altv, d which was View > Design View
Altv, s which was View > DataSheet View
Altv, q which was View > SQL View
To run an action query, this old keyboard shortcut still works, too:
Altq, r which was Query > Run
Ah, it turns out it's one of the view modes (first button in the Home tab). Because none of my functions required a table, I hadn't bothered to choose a table to work in, which means the View menu was grayed out.

SQL Management Studio 2008 - Server name on Query Editor tabs...where did they go?

I recently upgraded to SQL Management Studio 2008 (full not express, if it matters).
In 2005, when I was in the Query Editor, each tab (with an unsaved query) would have the servername-instance-query name or something like that, but all I cared about was seeing the server name there so I knew which server I was running my query on.
In 2008 it appears that they've decided to change the tab title to query name-servername, and the result of this is I can't see what server I'm working on without hovering over the tab and looking at the tooltip thing that pops up, which really slows me down. So currently all my tabs are titled something like "SQLQuery5.sql..." which is useless to me.
How can I get the servername back to the front the tab title?
It can be turned off/on in SSMS 2005, so possibly in 2008 you have it switched off.
Go to Tools -> Options -> Text Editor -> Editor Tab and Status Bar. Under "Tab Text" in the right hand panel, make sure "Include server name" is set to True.
If you have the SQL Editor menu checked up top then there is a drop down that tells you exactly what database you're in for the currently selected tab.
You should be running any queries in the active window? At the bottom there is a status bar with the server name and database name in it. That way you don't have to clutter the limited tab space with all that data.