IT Nota

  • Home
  • How To
  • .NET
  • WordPress
  • Contact

Perform Update, Delete and Insert using Merge Statement

In SQL Server, a better way to perform insert, update, or delete operations on a target table based on the results of a join with a source table is by using one MERGE statement.

UPDELSERT using MERGE statement

MERGE Table2 AS tgt
USING (SELECT name, descr, updatedate from Table1) AS src
ON src.name = tgt.name
WHEN MATCHED AND src.updatedate > tgt.updatedate THEN
	UPDATE SET descr = src.descr,
			   updatedate = src.updatedate
WHEN NOT MATCHED THEN
	INSERT (name, descr, updatedate) 
	VALUES (src.name, src.descr, src.updatedate)
WHEN NOT MATCHED BY SOURCE THEN DELETE;

It’s more efficient as you’re doing just one statement instead of three individual (UPDATE, DELETE, and INSERT) SQL queries.

More examples can be found on the next posting, Ways to Upsert a Record in SQL Server.

Further Reading

MERGE (Transact-SQL)

July 2, 2014 Filed Under: How To Tagged With: Microsoft SQL Server, SQL, SQL Server

How to Find Windows 8 or Windows 8.1 Key

As part of windows 8 upgrade to 8.1, if you do a fresh install of Microsoft Windows 8.1 using Windows 8 key, one issue you may run into is you may not have your Windows 8 product key handy. If you still have your old system running, you might be able to extract your Windows 8 (or 8.1) key from the registry by using a key finder software, so you should do this step first before installing 8.1 over the existing Windows 8.

There are many key finder software available, but I find Belarc Advisor (not affiliated) to work very well for this purpose. The program will create a detailed profile of your PC, including installed software, and save it in an HTML file to your local hard drive. Once profiling is complete, the HTML will automatically open in your browser. Click on Software Licenses on the left of the page to see your software.

Belarc Advisor Overview

On Software Licenses section, you should see most of your installed software listed along with the product keys. Not all product keys will be displayed, fortunately, Windows 8 product key is among the listed.

Belarc Advisor Software Licenses

Write down the Windows 8 product key and save it for your Windows 8.1 activation after installing it using KMS Key.

As you might have figured this out, this trick works not only for a windows upgrade, but you can also use this to reinstall windows 8.1 (or 8) without the serial number handy.

The FREE version (for personal use only) of Belarc Advisor is more than sufficient for this task and rest assured it does not send up your PC profile to a Web server across the Internet.

This solution does not always work, but I’ve seen good results in most cases. So I think it’s worth a try before you do anything more involved.

Download

Belarc Advisor – Free Personal PC Audit software.

May 21, 2014 Filed Under: How To Tagged With: Microsoft, Windows 8

How to Change Default Project Folder in SSMS

There are several ways to configure SSMS to point to your own working directory as the default. Here’s the easiest to do it without registry hack. You just need to edit the Visual Studio settings file (XML format).

Open Windows Explorer, and go to (you can force type):

%USERPROFILE%\Documents\SQL Server Management Studio\Settings

Find vssettings file with the latest modification date. The file name should follow the convention below.

CurrentSettings-YYYY-MM-DD.vssettings

Make a backup of that file. It’s an XML format and it’s very easy to make a mistake, but less dangerous than messing up your registry.

Open the file with a text editor.

Change from:

<PropertyValue name="ProjectsLocation">%vsspv_visualstudio_dir%\Projects</PropertyValue>

To:

<PropertyValue name="ProjectsLocation">%USERPROFILE%\Documents\My Directory</PropertyValue>

Save the file and make sure you quit SSMS and reload it before it takes affect.

That’s all there is to it. The next time you open a file or a project, SSMS will look into your custom folder first.

May 8, 2014 Filed Under: How To Tagged With: SQL Server, SSMS

How to Do Fresh Install Windows 8.1 with Windows 8 Key

Windows 8.1 is a free upgrade for Windows 8 owners. Unfortunately if you have Windows 8.1 disc and you want to do a fresh install, it won’t accept the Windows 8 key during the installation. To work around this, you can use the KMS Client Setup Keys during installation and enter your Windows 8 key after the installation to activate it.

As an example if you want to install a Windows 8.1 Professional using Windows 8 Professional (they both have to be the same edition), when you reboot your machine using Windows 8.1 DVD and it asked for a key during installation, you can enter the KMS Client Setup Key GCRJD-8NW9H-F2CDX-CCM8D-9D6T9 to bypass that screen. You don’t need to be connected to the Internet to do this.

Once the installation is done, connect to the Internet and open the System window.

Click on Activate Window link and this time, use your Windows 8 key to activate it. This is the best way to do an update to windows 8.1 without going through two installations. That’s all there is to it.

What if you lost or misplaced your Windows 8 product key?

Another Method

If you want to upgrade an older OS (XP or Windows 7) and you have your Windows 8 key, you can download the installation file from Upgrade Windows with only a product key page. Make sure you backup everything you want to keep and read the instructions carefully before deleting anything.

This method only works if you already have a running OS and it won’t work to upgrade a 32-bit version to a 64-bit.

Further Reading

KMS Client Setup Keys
Upgrade Windows with only a product key

April 25, 2014 Filed Under: How To Tagged With: Microsoft, Windows 8

DuckDuckGo as Default Search Engine in Chrome

If you want to use DuckDuckGo as your default search engine in Google Chrome browser, here are a few steps you need to follow to set that up:

  1. Go to Settings
  2. Under Search heading, select Manage search engines…

    Chrome Settings: Manage search engines...

  3. Under Other search engines box, fill in the form in this order:

    1. DuckDuckGo
    2. duckduckgo
    3. https://duckduckgo.com/?q=%s

    Chrome Settings: Other search engines

  4. Click Done and open Manage search engines… again.
  5. Make the Duckduckgo entry as the default.

    Chrome Settings: Make DuckDuckGo as default

  6. You should see in on Chrome’s omnibox now.

    Chrome Settings: DuckDuckGo default search engine

  7. Click Done.

Now when you type your search keyword on the URL box, the query will be passed to DuckDuckGo search engine. You can use the same step to use other search engines as your default in Chrome, just make sure you type-in the URL with the string parameter(s) correctly.

April 24, 2014 Filed Under: How To Tagged With: Internet

« Previous Page
Next Page »
Buy me a coffee Support this site
Buy Me a Coffee?

Categories

  • .NET
  • Coding
  • Cybersecurity
  • Database
  • How To
  • Internet
  • Multimedia
  • Photography
  • Programming
  • Resources
  • Review
  • Tips and Tricks
  • Uncategorized
  • Use Case
  • WordPress
  • Writing

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Recent Posts

  • How to View Stored Procedure Code in SQL Server
  • How to Find a String in SQL Server Stored Procedures
  • How to Remove Cached Credentials without Rebooting Windows
  • ESP Work Automation: Empowering Enterprises with Streamlined Workflows and Operational Efficiency
  • How to Search for a String in All Tables in a Database

Tags

.NET .NET Core AdSense ASP.NET Cdonts Dll Classic ASP Code Editor ETL FSharp Genesis Framework Git Google HP Asset Manager HTML5 Hugo IIS Information Security Internet Internet Information Services iOS JAMStack Linux macOS Microsoft Microsoft SQL Server MVC PHP PowerShell Python Simple Mail Transfer Protocol Smtp Server SQL SQL Server SSIS SSMS SSRS Sublime Text Visual Studio Visual Studio Code VPN Windows Windows 8 Windows 10 Windows 2012 Windows Server

Copyright © 2011-2026 IT Nota. All rights reserved. Terms of Use | Privacy Policy | Disclosure