SSMS SQL editor tool bar grayed out - sql

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).

Related

How to add custom SP calls to SSMS toolbar

Recently I've found out, that there's an option to include most commonly used queries to be executed by clicking a button on SSMS toolbar.
You can do that by following these steps:
Right mouse click on toolbar
Click Customize
Create new toolbar
Modify it
Add Command
Under Query categories there's option to add up to 9 Custom SPs
Now when I came here, things look like that:
However I'm struggling on how to add the actual procedure, that needs to be executed.
There's an option to add multiple SPs:
Custom SP 1
Custom SP 2
...
sp_help
sp_lock
sp_who
How do I assign my procedure to be Custom SP 1, for instance?
To be clear: My goal is to have a button in SSMS toolbar, which would execute my desired procedure (query) on click.
This is a great question imo, but to do this it's an awful way you'll have to go.
Unfortunately i have the German version of SSMS, so my screens might confuse you a little.
Following you can see a guide:
The Options-Window
Select a free Shortcut
Assign to Toolbar
This seems a bit uncomfortable, but this is the only way i know / can imagine on how to do this.
Let me know if this helps! Cheers
English version of SSMS
Go to Tools-> options

Show executed query in Microsoft SQL Server 2016

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.

visual studio editor expand collapse widgets are gone

The plus / minus signs are gone to expand / collapse regions. The vertical lines to indicate regions are gone too.
The regions are collapsing and all the commands under edit, outlining work fine.
It's just I have to double click on the collapsed region to expand and there's no way to collapse a region with the mouse. Only the shortcut keys (ctrl m, m) or the menu will do it.
I swear it was right this morning but I did something to mess it up. I can't find any option in tools to fix it either.
UPDATE
Now, some files are doing this and other files (both opened at same time) are not doing it. If anyone can explain, I'm all ears.
Press ctrl+, (control plus semicolon) to open the settings. And type Folding Strategy in the setting's search bar. It is set to auto by default. You can set it to always for the controls to be visible at all times, otherwise, it shows only on mouse over.
This same thing happens to me multiple times a day using VS.NET 2015 Pro version 14.0.24720.00 Update 1. Restarting the IDE always restores normal function for a while but the problem always returns, seemingly at random.
UPDATE:
I tried changing the theme from dark to blue and it restored the outlining. I then changed back to dark from blue and the outlining continued to work normally. Still a pain but definitely a lot faster than restarting the IDE.
It happened with me also. One file was just fine and other file (js) was not. I searched it a lot.
Try selecting a method/if check etc and press ctrl+M+H which is short cut for right click outlining > Hide Selection.
You can do it on the whole document as well.
This might be helpful when working on a file which has too much code in it and you are going through different functions again and again. It is painful with scrolling mouse for so long.
You can use short cut for for moving at the start of the method or at the end of the method with the following :
select parenthesis { start or end } and press ctrl+}
Hope this helps.
It works again.
I closed all windows and reopened my code file.
Now it shows the plus minus glyphs again.
I know this is an old post, but I wanted to share a quick solution. if you right click and hover over 'Outlining' and then click 'Collapse to Definition', the widget comes back. Then just press [ctrl] + z to undo and continue where you left off.
With Golang, if the code has some syntactic mistakes that would prevent it from compiling, the language server cannot decide which parts of the code are collapsible, and which not.
Therefore the solution is either switching to the Folding Strategy in VSCode settings to indentation folding, or fixing the syntactic errors.
Simple solution : CTRL + M + O, then CTRL + Z
Thanks to SparrowEatsHawk

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.

Deselect selected text in sql server management studio table-design cell w/out using mouse

This is something that has bothered me for years. When I am using SQL Server 2005 Management Studio and I am in the table designer and I'm editing the column definitions It is almost possible to do this entirely without using the mouse. However, if I'm navigating around the cells in this designer using the arrow keys, when I move to a new cell all the text is selected. Say I want to change a decimal(6,2) to decimal(6,3), so I move over there with arrow keys and the whole decimal(6,2) phrase is selected. I have been completely unsuccessful in finding a way to move the cursor to the beginning or end of the line. Instead any combination of ctrl, shift, alt and arrow keys blithely select the adjacent cell in that arrow's direction. So inevitably, I have to take my hands from the keyboard and use the mouse to click within the cell I want to edit and then I can edit the value without having to retype the entire thing.
GRRR!
Can anyone help me out with this one?
I will be eternally grateful (or at least as long as I use Sql server management studio)!
Thanks,
Uh... F2, right? That's always worked for me, in just about any program where you edit a grid
While playing around with #Damien's answer I found out an even better answer that I basically accept as the answer.
If you move to a cell and all the text is selected you can hit the escape key. All the text will still be selected but at this point you can use the navigation keys like arrows and Home and End and they will work as expected.
Okay, this is ugly, but you can do it with 3 keyboard actions: SPACE, CTRL-Z, RIGHT ARROW leaves the cursor at the end of the text, left arrow is then moving the cursor within the text.
But as I said in my comment, I'd just use a query window and write the SQL directly rather than using the table designer.