SQL Server Management Studio – tips for improving the TSQL coding process – Stack Overflow

[Origin]: https://stackoverflow.com/questions/101079/sql-server-management-studio-tips-for-improving-the-tsql-coding-process

community owned wiki Answer – feel free to edit or add comments:

Keyboard Shortcuts

  • F5CTRL + E or ALT + X – execute currently selected TSQL code
  • CTRL + R – show/hide Results Pane
  • CTRL + N – Open New Query Window
  • CTRL + L – Display query execution plan

Editing Shortcuts

  • CTRL + K + C and CTRL + K + U – comment/uncomment selected block of code (suggested by Unsliced)
  • CTRL + SHIFT + U and CTRL + SHIFT + L – changes selected text to UPPER/lower case
  • SHIFT + ALT + Selecting text – select/cut/copy/paste a rectangular block of text

Addons

Other Tips

  • Using comma prefix style (suggested by Cade Roux)
  • Using keyboard accelerators (suggested by kcrumley)

Useful Links

share

[Bash on Windows] Getting dbus and X server working

[Origin]: https://www.reddit.com/r/Windows10/comments/4rsmzp/bash_on_windows_getting_dbus_and_x_server_working/

submitted 1 year ago * by ShaRose

So, most people who are using bash subsystem in the windows 10 insider builds seem to be aware that it’s possible to use X servers for windows such as vcxsrv or Xming, but most applications require the dbus service, which doesn’t work. This results in applications like Firefox or virt-manager (when ran in the linux subsystem) to crash either on launch or after a short time, and so it’s seen as fairly buggy.

However, the main application I wanted to run for this was virt-manager, because I wanted to be able to administrate qemu servers on windows without having to use a VM to run that. virt-manager needs a dbus server to even launch, so I started trying to get it running: And I succeeded. And surprisingly, it was fairly easy.

All that needed to be done (From a clean install of windows 10 with Bash installed, of course) was do three steps:

1) install an X server. vcxsrv and Xming are confirmed to both work just fine.

2) add DISPLAY=:0.0 to your bashrc: you can do this by executing the following command

echo "export DISPLAY=:0.0" >> ~/.bashrc

Now X programs will show the window correctly.

3) Now we need to fix dbus: The issue with this was that by default, dbus uses unix sockets to communication, which windows bash at the moment doesn’t support. So we just need to tell it to use tcp. In /etc/dbus-1/session.conf, you need to replace <listen>unix:tmpdir=/tmp</listen> with <listen>tcp:host=localhost,port=0</listen> and then you are done. Note this file needs root to edit. An easy way to do this is to execute the following:

sudo sed -i ‘s$&lt;listen&gt;.*&lt;/listen&gt;$&lt;listen&gt;tcp:host=localhost,port=0&lt;/listen&gt;$’ /etc/dbus-1/session.conf

And now close bash, and open it again. Feel free now to run whatever: Firefox and virt-manager work. Chrome sadly doesn’t for another reason of note.

Hope that helps someone.

Client authentication error when starting Visual Studio 2015.3

[Origin]: https://stackoverflow.com/questions/38516736/client-authentication-error-when-starting-visual-studio-2015-3

I just performed a clean install of VS2015.3 and I’m getting this in the Output window at startup:

We were unable to automatically populate your Visual Studio Team Services accounts.

The following error was encountered: TF400813: Resource not available for anonymous access. Client authentication required.

I’m not using VSTS at all, nor have I configured any connections to it. (I do, however, have a connection configured to an on-premises TFS instance.)

How may I dispense with this error message? I’d like to instruct Visual Studio to never attempt a connection to VSTS at startup.

shareimprove this question

In the top right corner of Visual Studio, you will find a colored box with your name or your initials inside. click the down arrow and then Account Settings. In the opening window, please click “Sign out” in the upper left part of the window.

After a restart of Visual Studio and signing back in, the error should be gone.

shareimprove this answer

VS2015 The breakpoint will not currently be hit. No symbols have been loaded for this document

[Origin]: https://stackoverflow.com/questions/36445717/vs2015-the-breakpoint-will-not-currently-be-hit-no-symbols-have-been-loaded-for

I have solution with 3 projects. Project one – Library. Project two – Service (asmx). Project three – Test. In my service I have two config transform: PRODUCTION and TEST. They are equals, but name of databases is different. My solution:

Solution

If I Debug Test with PRODUCTION.config then all right – my breakpoints is active. If I Debug Test with TEST.config then bad. I get this:

The breakpoint will not currently be hit

What could be the problem? Sorry for my English.

shareimprove this question

Fixing:

  1. Right mouse click your project
  2. Select Properties
  3. Select the Build tab
  4. Make sure Define DEBUG constant and Define TRACE constant are checked
  5. Click the Advanced button at the bottom of the Build tabpage
  6. Make sure that Debug Info: is set to full
  7. Click OK and save changes
  8. Clean solution and rebuild the project

Link to source Fixing “The breakpoint will not currently be hit. No symbols have been loaded for this document.”.

(step 6 generates the .pdb files, these are the debugging symbols)

shareimprove this answer

Sql Server ‘Saving changes is not permitted’ error ► Prevent saving changes that require table re-creation

[Origin]: https://stackoverflow.com/questions/6810425/sql-server-saving-changes-is-not-permitted-error-prevent-saving-changes-that

When I create a table in SQL Server and save it, if I try to edit the table design, like change a column type from int to real, I get this error:

Saving changes is not permitted. The change you have made requires the following table to be dropped and re-created. You have either made changes to a table that can’t be recreated or enabled the option prevent saving changes that require the table to be re-created.

Why do I have to re-create the table? I just want to change a data type from smallint to real.

The table is empty, and I didn’t use it until now.

shareimprove this question

From Save (Not Permitted) Dialog Box on MSDN :

The Save (Not Permitted) dialog box warns you that saving changes is not permitted because the changes you have made require the listed tables to be dropped and re-created.

The following actions might require a table to be re-created:

  • Adding a new column to the middle of the table
  • Dropping a column
  • Changing column nullability
  • Changing the order of the columns
  • Changing the data type of a column <<<<

To change this option, on the Tools menu, click Options, expand Designers, and then click Table and Database Designers. Select or clear the Prevent saving changes that require the table to be re-created check box.

See Also Colt Kwong Blog Entry:
Saving changes is not permitted in SQL 2008 Management Studio

shareimprove this answer