1

The Invoke-Sqlcmd doesn't return data in rows, it lists each item separately

This is the code that I'm using:

Invoke-Sqlcmd -ServerInstance "MyServer" -Query "SELECT * FROM [MyDB].[dbo].[MyTable]"

I get something like this:

Key         : 81839
Type        : DELETE
TableName   : InstList
ColumnName  : Key
ID          : 1092110700485
OldValue    : 5216268
NewValue    : 
UpdateDate  : 7/22/2019 12:06:30 PM
UserName    : test
FeatureName : Instruments

Key         : 81840
Type        : DELETE
TableName   : InstList
ColumnName  : Key
ID          : 2101128532011
OldValue    : 5289370
NewValue    : 
UpdateDate  : 7/22/2019 12:06:30 PM
UserName    : test
FeatureName : Instruments

Why does it not come out in rows?

0

1 Answer 1

4

Why does it not come out in rows?

It is only matter or presenting data:

Invoke-Sqlcmd -ServerInstance "MyServer" -Query "SELECT * FROM [MyDB].[dbo].[MyTable]" 
| out-gridview

or:

Invoke-Sqlcmd -ServerInstance "MyServer" -Query "SELECT * FROM [MyDB].[dbo].[MyTable]" 
| Format-Table -AutoSize
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.