簡體   English   中英

如何使用Powershell將Azure表存儲中實體的屬性更新為null?

[英]How to use Powershell to update property of an entity in Azure Table Storage to null?

可以說我已經從表中檢索了一個實體。 我想將屬性之一設置為null。 我該怎么做? 這是我所做的:

 $myData.PropertyOne = $null
 $myData | Update-AzureStorageTableRow -table $destStorageTable 

但是我得到了錯誤:

使用參數“ 1”調用“ Execute”的異常:“對象引用未設置為對象的實例。” 在C:\\ Program Files \\ WindowsPowerShell \\ Modules \\ AzureRmStorageTable \\ 1.0.0.21 \\ AzureRmStorageTableCoreHelper.psm1:629 char:13 + ... return($ table.CloudTable.Execute((invoke-expression“ [Microsoft ... +〜 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ + CategoryInfo:未指定:(:) [],MethodInvocationException + FullyQualifiedErrorId:StorageException

我該怎么做?

問題在於,由於azure表存儲沒有架構,因此null列實際上不存在。 如果確實需要,您可以執行類似存儲空字符串的操作。

 $myData.PropertyOne = ""
 $myData | Update-AzureStorageTableRow -table $destStorageTable 

在此處輸入圖片說明

我認為您需要刪除該列-

$myData.psobject.Properties.Remove('PropertyOne')
$myData | Update-AzureStorageTableRow -table $destStorageTable 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM