
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-11-2013 05:50 PM
I am trying to utilize the custom fields in Lansweeper. I am trying use the follow sql to update the custom1 field if the server name is server01. I'm not sure what I'm doing wrong.
use lansweeperdb
Update dbo.tblAssetCustom
set Custom1 = 'test'
Select tblAssets.AssetID, tblassets.AssetName, tblAssetCustom.AssetID, tblAssetCustom.Custom1
from tblAssets
Inner Join tblAssetCustom on tblAssets.AssetID = tblAssetCustom.AssetID
where tblassets.AssetName = 'Server01'
This script does not do what I intended, it updates all of the fields in tblAssetCustom when I only want to update where tblassets.AssetName = 'Server01'
The reason I am wanting to do this is I have a powershell script that I wrote that will read a .cvs file that is an export from the inventory system that lansweeper replaced and I need to be able to traverse that file and only update records based on specific conditions.
Any assistance would be greatly appreciated.
thanks
Chad
use lansweeperdb
Update dbo.tblAssetCustom
set Custom1 = 'test'
Select tblAssets.AssetID, tblassets.AssetName, tblAssetCustom.AssetID, tblAssetCustom.Custom1
from tblAssets
Inner Join tblAssetCustom on tblAssets.AssetID = tblAssetCustom.AssetID
where tblassets.AssetName = 'Server01'
This script does not do what I intended, it updates all of the fields in tblAssetCustom when I only want to update where tblassets.AssetName = 'Server01'
The reason I am wanting to do this is I have a powershell script that I wrote that will read a .cvs file that is an export from the inventory system that lansweeper replaced and I need to be able to traverse that file and only update records based on specific conditions.
Any assistance would be greatly appreciated.
thanks
Chad
Solved! Go to Solution.
Labels:
- Labels:
-
Report Center
1 ACCEPTED SOLUTION
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2013 01:37 AM
Maybe something like this?
UPDATE
tblAssetCustom
SET
Custom1 = 'test'
FROM
tblAssetCustom
INNER JOIN tblAssets ON tblAssets.AssetID = tblAssetCustom.AssetID
WHERE
tblAssets.AssetName = 'Server01'
2 REPLIES 2

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2013 03:10 PM
That did the trick. Thank you.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-13-2013 01:37 AM
Maybe something like this?
UPDATE
tblAssetCustom
SET
Custom1 = 'test'
FROM
tblAssetCustom
INNER JOIN tblAssets ON tblAssets.AssetID = tblAssetCustom.AssetID
WHERE
tblAssets.AssetName = 'Server01'
