Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Compare SQL column against another column

Posted on January 29, 2015October 26, 2015 By David Kittell

In a recent effort to clean up duplicates in my contacts I came across a script to assist me.

In my situation I have some contacts that have had the company name inserted as the first/last name.

SELECT id,
	[Company],
	[Title],
	[First Name],
	[Middle Name],
	[Last Name]
FROM [OutlookContacts]
WHERE Company LIKE '%' + [First Name] + '%'
ORDER BY [Last Name]

In my case almost all of the records could be modified to null the first and last name but if you need to limit the update modify the WHERE statement accordingly.

UPDATE [OutlookContacts]
SET [First Name] = NULL,
	[Last Name] = NULL
WHERE Company LIKE '%' + [First Name] + '%'
Originally Posted on January 29, 2015
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code MSSQL SQL

Post navigation

Previous post
Next post

Related Posts

INI DB

Posted on July 18, 2013October 26, 2015

<% ‘**************************************************************************** ‘* Terms Of Use * ‘**************************************************************************** ‘**************************************************************************** ‘* This script is provided free of charge by WebEarth Network. * ‘* http://www.web-earth.net * ‘* by all mean feel free to modify any or all content of this script, * ‘* feel free to do anything with it you wish,…

Read More

Raspberry Pi – Install Firefox and Thunderbird on Raspbian

Posted on April 9, 2018

sudo apt install dirmngr echo "deb http://ppa.launchpad.net/ubuntu-mozilla-security/ppa/ubuntu trusty main" | sudo tee /etc/apt/sources.list.d/firefox.list echo "deb-src http://ppa.launchpad.net/ubuntu-mozilla-security/ppa/ubuntu trusty main" | sudo tee /etc/apt/sources.list.d/firefox-source.list echo "deb http://ppa.launchpad.net/mozillateam/thunderbird-next/ubuntu trusty main" | sudo tee /etc/apt/sources.list.d/thunderbird.list echo "deb-src http://ppa.launchpad.net/mozillateam/thunderbird-next/ubuntu trusty main" | sudo tee /etc/apt/sources.list.d/thunderbird-source.list sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys A6DCF7707EBC211F sudo apt-key adv…

Read More

JavaScript OnClick – Change Form Value

Posted on February 11, 2014December 23, 2016

<input type="hidden" name="thingy" value="" /> <input type="submit" value="submit1" onclick="document.forms[0].elements[’thingy’].value = ‘submit1 clicked’;return true;" /> <input type="submit" value="submit2" onclick="document.forms[0].elements[’thingy’].value = ‘submit2 clicked’;return true;" /> Originally Posted on February 11, 2014Last Updated on December 23, 2016 All information on this site is shared with the intention to help. Before any source code…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes