A personal repository of technical notes. - CSC

Customize Context Menu of SSMS

Problem
Need to customize context menus (also known as shortcut menus) in SQL Server Management Studio.

Solution

Note: This was tested in SSMS 2012.

Use the same technique that is used for Visual Studio. See Customize Context Menu of Visual Studio | CSC - Technical Notes for detailed instructions.

Copy Page Title and URL to Clipboard

Bookmarklet to copy page title and URL to clipboard in Internet Explorer

JavaScript:window.clipboardData.setData("Text",document.title + "\r\n" + location.href);void(0);

Drag this bookmarklet to the bookmarks bar: JavaScript:window.clipboardData.setData("Text",document.title + "\r\n" + location.href);void(0);

Bookmarklet to copy page title and URL to prompt window for copying to clipboard in Chrome

JavaScript:window.prompt("Copy page title and URL",document.title + "\r\n" + location.href);void(0);

Drag this bookmarklet to the bookmarks bar: JavaScript:window.prompt("Copy page title and URL",document.title + "\r\n" + location.href);void(0);

FULL OUTER JOIN Not Working

Problem

FULL OUTER JOIN not returning all records from right table when left table has a Search Condition in the WHERE clause.

-- Full outer join with where clause at bottom
-- Returns all records from MyTable1 where Category is 23.
-- Does not return all records from MyTable2. Only matches with MyTable1.
SELECT t1.[Code],t2.[Code]
FROM [MyTable1] t1
FULL OUTER JOIN [MyTable2] t2
      ON t2.[Code] = t1.[Code]
WHERE t1.[Category] = 23

Solution

Use a Derived Table for the left table. The Search Condition is moved from the WHERE clause to the Derived Table query.

-- Full outer join with derived table, no where clause at bottom
-- Returns all records from MyTable1 where Category is 23.
-- Returns all records from MyTable2.
SELECT t1.[Code],t2.[Code]
FROM ( SELECT * FROM [MyTable1] WHERE [Category] = 23 ) t1
FULL OUTER JOIN [MyTable2] t2
      ON t2.[Code] = t1.[Code]

References

See also SQL Join Types