title: How to Separate server name and instance name from @@servername in SQL Server
body: <p>How can I separate Server name and Named instance from @@servername. I know I could just use serverproperty to collect just the Machine name or instance name but I am working with two tables where I have to join on the table name. Table1 has the just the Server name as an "TESTDB01" and Table2 has Server Name and the Instance name as an TESTDB01\InstanceName. </p>
  
  <p>When I Join these tables together, anything with the Named Instances will be missed as it has "\InstanceName" , only the default Instance will get picked up. </p>
  
  <p><a href="https://i.stack.imgur.com/jnYXM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jnYXM.png" alt="See Attached Pic"></a></p>