CTRL + K, CTRL + F (Format Code) Not Working in MS SQL Server - sql-server

The format selection command isn't working in SQL server management studio 2008 for me and I'm wondering if anyone might know how to get it working. I don't know if it was ever working.

Do you have any add-ins installed? For me Ctrl+K, Ctrl+F brings up the SSMS Tools Pack find dialog. So perhaps this is happening because an add-in has taken over the keyboard combo.
Also, what is your keyboard scheme under Tools > Options > Environment > Keyboard? If this has been switched to "SQL Server 2000" you might try switching it back to Standard.
Finally, I believe there are cases where the keyboard shortcuts can get messed up depending on the co-existence and order of install for Visual Studio / BIDS etc.

IN SQL SERVER 2014
First do: Ctrl +K
Then: Ctrl+ Y

I know this post is really old, but for people searching for answers to this question I have this to add:
The Ctrl+K, Ctrl+F key combination for format code comes from poorsql.com. They have a SSMS/Visual Studio plugin. As of this date they currently support up to SSMS 2017.

This feature isn't available on SQL Server Management Studio.
There are various add-on's you can use to do this. I personally use ApexSQL. It gives you the option to create your own format template, so that your code is always easily readable for you.

Check this link:
http://www.mssqltips.com/sqlservertip/2413/sql-server-management-studio-keyboard-shortcuts-part-1-of-2/
...You can select specific lines and hit CTRL+K
followed by CTRL+C to comment it out and
CTRL+K followed by CTRL+U
to uncomment it out...

Related

How do you debug or step through the code in SQL Server Management Studio 18?

SQL Server Management Studio used to have Debug functionality that would allow to step through the code and watch the values etc. Referring to How to add the Debug button to SSMS v18?, I understand that the functionality is removed from SQL Server Management Studio V18.1.
But what is the alternative now? How do you step through the code to pinpoint a bug in the code?
You can use Visual Studio (the full IDE) to do it:
Use "Server Explorer" (Under the View menu) to connect to your DB
Right-click the DB and choose "New Query" (or find a stored procedure to debug)
Set a break point (F9 key or otherwise) on a line of SQL
Right-click inside the SQL editor and choose "Execute with Debugger"
Your best option is to not upgrade version 18.X, but stay on 17.9 until the Microsoft Product Manager gets sacked. A similar thing happened in going from SQL Server 2000 to SQL Server 2k5. Eventually, they capitulated and re-introduced the feature.
Ta for answer above, but when trying to debug with Sever Explorer, I find that "SQL Debugging is not supported on Microsoft Azure SQL Database'... ho hum, so I downgrade to SSMS 17.9 or dump the database to local and do it there.
Nice, I just wanted to quickly debug something... by the time I've done that lot I'll have forgotten what the problem I was trying to fix was !
It's deprecated, so you don't. Personally, I never use the feature and I'm assuming many others didn't either (which is why it's being retired).
The work around is to debug stored procedures by outputting values using PRINT or RAISERROR. Using BEGIN TRAN / ROLLBACK this works well because you can easily run code against the same data.
It's not the same as step through debugging, but it works.

SQLSMS Intellisense on linked server

I'm trying to work Microsoft SQL Server Management Studio 10.0.5538.0 (latest right now) with Intellisense on linked servers, for example:
SELECT Column FROM [LinkedServer].DatabaseName.dbo.Table WITH(NOLOCK)
But I couldn't find a way to make intellisense show results as I write SQL code (it works fine with non-linked servers)
Things I've tried:
Look for answers in SQLSMS docs.
Look for specific config option in the application.
Update local cache in Edit -> IntelliSense -> Refresh local cache.
Thanks for your help,
Apparently this isn't supported.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/ef973d28-6450-451c-840f-9d14c7ae4ed1/intellisense-invalid-object-name-on-linked-database-runs-fine?forum=sqldatabaseengine
One reason given is that this linked server could be Oracle, Excel... anything, and to support that is unfeasible
As an addendum to this answer by BenXvisual, in SSMS 17.9.1 (14.0.17289.0) hotkey for switching off Intellisense is Ctrl-B, Ctrl-I.
While it isn't supported from a linked server at least turning off IntelliSense makes it a lot clearer. This can be done by simply pressing CTRL-I while in the query window. The same keyboard shortcut turns it back on again when required.

sql server 2014 management studio not supporting windows 8?

im tring to insatll sql server 2014 management studio in windows 8 . but it shows error message that system does not support . How will i install it in my windows 8 or should i go for any other version of sql??
You must tell what edition of SSMS you are trying to install. As per Microsoft Hardware and Software requirement for SQL Server 2014 Enterprise and BI edition is not supported on Client OS(Windows 8) but it wont block the installation it will allow you to install. Have yu read the requiremnts ?
Can you please add error message and edition information in your question I would be able to help you better. I strongly suggest you to read How to use SQL Server on Windows 8
Edit:
Could not write value to /Softwre
Please add complete details about problem in Question. How do you suggest we can help you with little piece of information. Have a look at This Stackexchange thread and also at this support article
What you can do
1.Click Start, click Run, type control userpasswords, and then click OK.
2.Create a new computer administrator account.
3.Click Start, click Run, type regedit, and then click OK.
4.In Registry Editor, right-click HKEY_CURRENT_USER\Software, and then click Permissions.
5.Click Add, type Everyone, and then click OK.
6.Under Group or user names, click Everyone.
7.Under Permissions, click to select Full Control in the Allow column, and then click OK.
8.Locate the following subkeys:
HKEY_LOCAL_MACHINE\Software
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Setup
9.Unregister and then reregister the Microsoft Windows Installer service. To do this, follow these steps:a.Click Start, click Run, type msiexec /unregister, and then click OK.
b.Click Start, click Run, type msiexec /regserver, and then click OK.
This can also be caused if any malware or addon is running on your system which can block access to the registry. Please clean your system and make sure any unwanted software is removed. If possible format the OS and try installing again

When pressing F1 hotkey in SQL Server 2008 R2 hang my Maganement Studio?

Sometimes I miss the 1 or the F2 in my computer keyboard when using SQL Server Maganement Studio, that causes my SQL MS to hang and the I have to close it with the Task Manager, but many time I loss a lot from the queries I was working on, so I would like to fix this problem,
Maybe someone here has the same problem.
Microsoft Document Explorer
The Application Data folder for Microsoft Document Explorer could not be created
Right click on the SSMS program (in the start menu / desktop) and select "run as administrator". Do whatever you do to cause SSMS to hang, quit and re-run as normal user. This should remove that warning.
After many intents to solve this problem, I received this message:
External help is not available because Microsoft Document Explorer is
not installed. To view help, change your Help preferences to use the
Integrated Help Viewer or Install Microsoft Document Explorer
I tried to do it at Tools->Options->Help->General->
Show Help usaing: Integrated Help Viewer
Search Result per page: 20
Show Topic abstracts: checked
Reuse Topic window: checked
Highlight search termn: checked
I had to tried many times until SSMS wanted let me to do it.
Now the problem has been partially solved, when I press F1 the SSMS does not hang, but when I still try to change something in the help options, then chunks..

How can I execute a single query in SQL Server Management Studio?

Background: I'm using SQL Server Management Studio 2008 and I have a query window open that contains multiple queries.
Is there a keyboard shortcut that will allow me to execute a single query without highlighting the query I would like to run first? Some other SQL tools have shorcuts that run the query that is under the cursor, which keeps the hands on the keyboard, and away from the mouse.
I did some searching and was unable to find any keyboard shortcuts for executing individual lines in SSMS. There is a reference online though.
http://msdn.microsoft.com/en-us/library/ms174205.aspx
Personally I just highlight the row in question (Shift + End or Shift + ↓, etc.) and hit F5.
Ctrl + E works just as well on a Mac.
The usual Shift + Arrow or Shift + PgUp / PgDown that apply to most or all Windows apps...
Then I use Ctrl + E to execute
Highlight the query you want to run, then F5.
Since this was originally asked, DevArt has added this functionality to their SSMS add-on . After installation, press Ctrl-Shift-E to execute the statement block under the cursor.
This isn't exactly what the OP was after, but here are two related tips that might help:
SSMS 2008 had a handy feature where you can double click the left margin (where the line numbers are) and it will auto-expand your selection to the beginning and end of the query that contains that line. So, double-click, f5.
It also had a nice feature which was, iirc, alt+up/down or maybe alt+shift+up/down, which will extend your selection to the beginning and end of line for each line you move the cursor across, including the one you started on, regardless of where your cursor is on the line. So this is another handy way to select the query you want to execute.
SSMS 2012 did away with those shortcuts (maybe they exist, but they're not the SAME, by default).
With SSMS 2012 you can try SSMS Executor add-in.
Default shortcut Ctrl-Shift-E.
I just mark the line I'm on (Shift + ↓ or Shift + End), and then click Alt + X.
In SSMS 2008R2 with line numbers displayed, you can double-click a line number anywhere adjacent to a query to select the entire query that's part of that line. It's a great feature and I use it all the time.
Unfortunately the feature was lost in the 2012 transition to the Visual Studio editor. I created a Connect issue for this, which I welcome votes on.
A new version of SSMS is in development by Microsoft (kind of new version) it's called SQL Operations Studio.
With SOS (haha) you can hit Ctrl+F5, or — like me — replace the shortcut to Ctrl+Enter
SQL Server Management Studio don't have the feature to execute single SQL statement from the SQL script editor. even we create different shortcut still it doesn't work as we want.
I found a alterative for SQL Server Management Studio => DBeaver
, community version is free.
Download DBeaver
Select SQL server option to connect
Download connector if not already installed(Auto suggest, popup will come)
Shortcut to execute SQL statement/Single line query -> Ctl + Enter
To execute SQL script -> Alt + X
Ctrl k + u will high lite text
f5 to run

Resources