Show Only the Domain of an Email Address in SQL Server
When performing data analysis of email data in SQL, there’s often a need to show only the domain of an email address.
Hello and welcome to my tech blog, which is a place for me to store all my notes as I blog away as a software enthusiast.
My area of interest, or niche, very much revolves around Database Administration, so there will be a lot of RDMS related blog posts here, particularly on SQL Server. I spend a lot of time testing random features during my journey as a Database Administrator (DBA). This tech blog is a good place to store notes for personal reference. I do try my best to keep things accurate and informative for those landing on my pages via Google search too though.
If you want to know more about who’s writing this have a look at my about me page here.
I hope you find some of my posts useful and feel free to get in-touch. If anything I say is inaccurate or if you’d like to offer some general feedback please go ahead, I’d really appreciate it.
Cheers,
Pete
Certificates & Encryption CSV Files Database Admin Database Backups Data Types Deleting Data Error Messages Exporting Data Featured Git Importing Data Installing SQL Server Linked Servers Linux Admin Logging & Monitoring Measuring Databases Restoring Databases SQL Server Agent SQL Server ETL SQL Server Management Studio SQL Server Processes SQL Server Scripts Windows Admin WordPress Technical Issues WordPress Tutorials WSL
When performing data analysis of email data in SQL, there’s often a need to show only the domain of an email address.
The Use command in SQL Server is a way to change context to a specified database, which I often refer to this as scoping to a database for a query.
When you log into SQL Server using SQL Server Management Studio (SSMS), opening a new query window will automatically scope you within the default database set when your user was created.
Oh-my-posh is a theme engine for PowerShell that’s separate from your default PowerShell console. It’s powered by posh-git and has status indications for git, failed, and admin commands.
Windows Terminal is a more modern command-line tool that has features including “multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and the ability to create your own themes and customize text, colors, backgrounds, and shortcuts“.