cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Alexey
Engaged Sweeper
Hi!
Can I specify the "last logon" variable of the user in the description of a specific computer?

For example, I have a "pc-20-18" computer with AssetID = 516. The last logged in user on it is always the same, because this is his personal corporate PC. Can I use a variable or key for this asset in the description field?
21 REPLIES 21
prighi61
Engaged Sweeper III
Hi Alexey, you can google for "sql server create trigger after update" to search for trigger examples. I don't think the Last Logon field gets filled during the first insertion (in case you should add the insert clause).
You should check whether the "Last Logon" contents exists and it has not already been added to the Description (so to don't add it multiple times).
An update script should be something like:

Update [tblAssets]
Set [Description] = [Description] + ' used by ' + Userdomain + '\' + Username
where Userdomain is not null and Username is not null and Description not like '% used by ' + Userdomain + '\' + Username

If the field that you want to append to the description is a custom field then you should include tblAssetCustom and build subqueries.


prighi61
Engaged Sweeper III
Hi Alexey, I think you need to define a trigger on the tblassets to achieve that.