Powershell SQL stored procedure with return_value

I’ve been stuck with this issue,

I start a stored function in sql that gives me a returned value,

When I use this value in a IF statement I can compare it against another value,

Now I want to store is in an other $var but now it becomes a ‘table’ and I cannot get the value out

if i do


PS C:\Users\bdv> $dataset.Tables
Return Value ------------ 980
i get the following values.
How can I get only the 980 returned as a string ?
if i use the out-string I get 'table' in there

Well after some more testing I have the result I want,


$dataset.Tables.‘return value’

I’ll leave it here for if someone needs it

Yeppers, spaces and special characters, in field names, file names, etc., are bad, just bad.
So, you end up doing what you had to do. This sort of thing is notorious all over XML and HTML files, pages and datasets.
So, what you had to do is really a common thing.

Hi There!

My colleague had the same issues. Yes you can $var.‘property name’ to specify properties that have spaces. However I would defiantly recommend perform a SELECT AS in the stored proc to simplify the PowerShell.

PS. To call variables with spaces ${variable name}. :slight_smile: