mithrandyr / SimplySql

PowerShell module for querying various SQL databases
MIT License
202 stars 30 forks source link

PowerShell JSON objects aren't being processed properly #138

Closed mithrandyr closed 8 months ago

mithrandyr commented 8 months ago
#create some Json object
$json = Get-ChildItem | ConvertTo-Json -Depth 2

Open-SqlConnection
Invoke-SqlUpdate -Query "CREATE TABLE #test (val AS varchar(max))"

#this line will fail
Invoke-SQLUpdate -Query "INSERT INTO #test (val) VALUES (@val)" -Parameters @{val = $json}

#this one will succeed
Invoke-SQLUpdate -Query "INSERT INTO #test (val) VALUES (@val)" -Parameters @{val = $json.ToString()} 
mithrandyr commented 8 months ago

Resolved in version 2.0.2