SQL Query for primary users
Hi guys,
We'd like to provide our users with a "summary page" for their Hardware Assets that shows:
Asset Name | Serial Number | HW Asset Status
Everyone should be able to ONLY view their own assets so we need to set up the condition for the HW asset primary user to be identical to the logged in user.
I'm not that skilled with SQL query writing, can anyone help me out a bit with this [i guess it's probably something trivial :) ]
We tried this one but it didn't work:
SELECT [DisplayName],
[HardwareAssetStatus]
,[SerialNumber]
FROM [ServiceManagement].[cachert].[csnCached_HardwareAsset]
WHERE [HardwareAssetHasPrimaryUser_DisplayName] = @UserID
Without the where function it worked fine but showed everything for everyone and we don't really want that 😊
Thanks in advance!
G.
Best Answer
-
Gabriel_Lences Customer Advanced IT Monkey ✭✭✭
Nevermind, got it working , just needed to add ,[HardwareAssetHasPrimaryUser_BaseManagedEntityId] and put that in the WHERE string, don't know what i was thinking equaling the displayname with userid 🙄
1
Answers
Nevermind, got it working , just needed to add ,[HardwareAssetHasPrimaryUser_BaseManagedEntityId] and put that in the WHERE string, don't know what i was thinking equaling the displayname with userid 🙄