SQL Query Help

Soldato
Joined
30 Sep 2005
Posts
16,678
Hi Everyone,

SQLServer1 - Database Assets (column assets has a record called as123456)
SQLServer2 - Database SCCM (column name has a record called pc123456)

Query

SELECT l.Asset AS [Asset], m.name AS [Name] FROM sqlserver1.assets.dbo.assets l
LEFT JOIN sqlserver2.sccm.dbo.computers m
ON replace(l.asset,'as','') LIKE '%m.name%'

I'm trying to remove the 'as' part of the asset name and then match it up with the pc record in the second database.
The value of the name column keeps coming up as null

any ideas?
 
Thanks everyone,

Unfortunately the second table (pc123456 doesn't always start pc sometimes it's lt). I'm going to use a combination of substring and adding in the + this morning
 
Back
Top Bottom