→ 🚀What's New? Explore Lansweeper's Fall 2024 Updates! Fall Launch Blog !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
MustQ
Engaged Sweeper
Complete SQL newb here. I have the below report, and I want to know when Custom07 is "blank"/has no data. Need to narrow down my assets and make sure these blanks are filled in. Thanks!

Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tsysAssetTypes.AssetTypename,
tsysAssetTypes.AssetTypeIcon10 As icon,
tsysAssetTypes.AssetType,
tblAssetCustom.Manufacturer,
tblAssetCustom.Model,
tblAssetCustom.Serialnumber,
tblAssets.Description,
tblAssetCustom.Comments,
tblAssetCustom.Custom1 As [Invoice Date],
tblAssetCustom.PurchaseDate,
tblAssetCustom.Warrantydate,
tblAssetCustom.Department,
tblAssetCustom.Location,
tblAssetCustom.OrderNumber,
tblAssetCustom.Custom2 As Vendor,
tblAssetCustom.Custom3 As [P/O #],
tblAssetCustom.Custom4 As [Invoice #],
tblAssetCustom.Custom10 As [Invoice URL],
tblAssetCustom.Custom5 As [Payment Type],
tblAssetCustom.Custom6 As [Invoice Total],
tblAssetCustom.Custom7 As [Price Per Unit],
tblAssetCustom.Custom8 As [Original Assigned User],
tblAssets.Username As [Last User Logon],
tblAssetCustom.Custom9 As [Associated PC],
tblAssetCustom.State,
tblAssets.Lastseen
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tsysAssetTypes On tsysAssetTypes.AssetType = tblAssets.Assettype
Where tsysAssetTypes.AssetType Not In (0, 200)
1 ACCEPTED SOLUTION
RCorbeil
Honored Sweeper II
Rethinking it, if you really want to cover your bases, you should probably allow for spaces having been entered and trim them before checking for an empty string.
WHERE tsysAssetTypes.AssetType NOT IN (0, 200)
AND ( (tblAssetCustom.Custom7 IS NULL)
OR (RTrim(tblAssetCustom.Custom7) = '')
)

View solution in original post

3 REPLIES 3
RCorbeil
Honored Sweeper II
Rethinking it, if you really want to cover your bases, you should probably allow for spaces having been entered and trim them before checking for an empty string.
WHERE tsysAssetTypes.AssetType NOT IN (0, 200)
AND ( (tblAssetCustom.Custom7 IS NULL)
OR (RTrim(tblAssetCustom.Custom7) = '')
)
MustQ
Engaged Sweeper
I'm learning already! 🙂 going to keep that in my notes for other "fill in the blank" reports that I need to do 🙂
RCorbeil
Honored Sweeper II
Like this?
WHERE tsysAssetTypes.AssetType NOT IN (0, 200)
AND ( (tblAssetCustom.Custom7 IS NULL)
OR (tblAssetCustom.Custom7 = '')
)