cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
TylerVice
Engaged Sweeper II
Basically, my hope is to have the info that shows in "Last User" to also show up in Description, so that it wouldn't need to be typed manually each time. I apologize if this was already covered somewhere, I couldn't find it.
10 REPLIES 10
Esben_D
Lansweeper Employee
Lansweeper Employee
You sure you copied and pasted the query correctly into SSMS?
TylerVice
Engaged Sweeper II
Charles.X wrote:
You sure you copied and pasted the query correctly into SSMS?


Pretty sure, this is the exact content pasted:

update tblassets
set Description = Description + ' ' + Username + ' ' + Statename
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblState On tblState.State = tblAssetCustom.State
Esben_D
Lansweeper Employee
Lansweeper Employee
If you want to add state too it becomes a bit more complex because the statename is stored in a different database table. If you want to add more things you can always look them up in the database dictionary or the report builder in Lansweeper.

This should work:

update tblassets
set Description = Description + ' ' + Username + ' ' + Statename
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblState On tblState.State = tblAssetCustom.State
TylerVice
Engaged Sweeper II
Charles.X wrote:
If you want to add state too it becomes a bit more complex because the statename is stored in a different database table. If you want to add more things you can always look them up in the database dictionary or the report builder in Lansweeper.

This should work:

update tblassets
set Description = Description + ' ' + Username + ' ' + Statename
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblState On tblState.State = tblAssetCustom.State


Hi Charles,

I finally got the chance to backup and then test this, its giving me the error "- There was an error parsing the query. [ Token line number = 4,Token line offset = 1,Token in error = From ]"
TylerVice
Engaged Sweeper II
Charles.X wrote:
If you want to add state too it becomes a bit more complex because the statename is stored in a different database table. If you want to add more things you can always look them up in the database dictionary or the report builder in Lansweeper.

This should work:

update tblassets
set Description = Description + ' ' + Username + ' ' + Statename
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblState On tblState.State = tblAssetCustom.State


Thanks again! 😄
Esben_D
Lansweeper Employee
Lansweeper Employee
For your specific question, if you write the database script, you can use it in the future too.

For your specific case the script below should work, it will add the last user behind the current text in the description field.
I would recommend creating a backup of your installation before you run the script to be safe, you can find backup instructions here: https://www.lansweeper.com/kb/94/backing-up-your-installation.html

update tblassets
set Description = Description + ' ' + Username
TylerVice
Engaged Sweeper II
Charles.X wrote:
For your specific question, if you write the database script, you can use it in the future too.

For your specific case the script below should work, it will add the last user behind the current text in the description field.
I would recommend creating a backup of your installation before you run the script to be safe, you can find backup instructions here: https://www.lansweeper.com/kb/94/backing-up-your-installation.html

update tblassets
set Description = Description + ' ' + Username


Hi Charles,

Thank you so much for your assistance!

If I could just request a walkthrough on backing it up, as I haven't personally done that yet?

Also, is there a way I can also add in the state of the asset in description? Would that be something like

update tblassets
set Description = Description + ' ' + Username + State ?

I really appreciate your time and assistance, thanks again!
TylerVice
Engaged Sweeper II
TylerVice wrote:
Charles.X wrote:
For your specific question, if you write the database script, you can use it in the future too.

For your specific case the script below should work, it will add the last user behind the current text in the description field.
I would recommend creating a backup of your installation before you run the script to be safe, you can find backup instructions here: https://www.lansweeper.com/kb/94/backing-up-your-installation.html

update tblassets
set Description = Description + ' ' + Username


Hi Charles,

Thank you so much for your assistance!

If I could just request a walkthrough on backing it up, as I haven't personally done that yet?

Also, is there a way I can also add in the state of the asset in description? Would that be something like

update tblassets
set Description = Description + ' ' + Username + State ?

I really appreciate your time and assistance, thanks again!


Pardon me for overlooking the instructions you attached for backing up the server! I have printed them out and will go through them tomorrow, sorry about that. If you could still assist with the question about including asset state, that would be awesome!
Esben_D
Lansweeper Employee
Lansweeper Employee
I recommend using asset custom fields as explained here: https://www.lansweeper.com/kb/393/configuring-and-adding-data-to-asset-custom-fields.html

To update these fields in bulk you can use the top Mass Edit Assets button on the assets overview page as seen below:
Mass edit assets

If this doesn't work for you, you can always write a custom database script to perform the changes. I would recommend taking a backup before doing this, backup instructions can be found here: https://www.lansweeper.com/kb/94/backing-up-your-installation.html