Skip to content

-AsDataTable returns 1 object? #150

Answered by mithrandyr
fenrisvlfr asked this question in Q&A
Discussion options

You must be logged in to vote

@fenrisvlfr -- the -AsDataTable simply means that the results will be a one or more datatable objects (by default, Invoke-SqlQuery returns a list of DataRows if there is only one resultset and a list of DataTables if there are more than one resultset).

Compare-Object (in this case), probably won't do what you want, which is to compare the datarows and see if they are the same.

There are a couple of ways that you can handle this. One: use Compare-Object with the -Property value and specify which properties you want to compare, however you will have to do this in a loop (since you would be comparing DataRow to DataRow). If this option is giving you trouble, you can use the -AsStream switch on

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fenrisvlfr
Comment options

Answer selected by fenrisvlfr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants