Using Powershell and sqlcmd-invoke to read/write SQL data results in thee dots

by Howard Ching Chung   Last Updated January 13, 2018 12:06 PM

I'm experiencing weird behaviour using sqlcmd (powershell cmdlet). If I use a
select * in the query I get proper result, if I specify a column (n)varchar(max) I get three dots (...)

Invoke-Sqlcmd -ServerInstance $SQLServer -Database $DBName -Username $UserDB -Password $WW -Query "SELECT * FROM [admin].[datafactory_Generated_ET]"

Result:

TABLE_NAME : datafactory_sourcetables GENERATED_ET : IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[BICC].[admin_datafactory_sourcetables_ET]') AND type in (N'U')) DROP EXTERNAL TABLE [BICC].[admin_datafactory_sourcetables_ET];

The output actually continues pasting the generated sql script but you get the idea. But If I specify the column with select [column] from ..:

Invoke-Sqlcmd -ServerInstance $SQLServer -Database $DBName -Username $UserDB -Password $WW -Query "SELECT [GENERATED_TABLE] FROM [admin].[datafactory_Generated_ET]"

All I get is dots (3 per row):

GENERATED_ET ... ... ...

Am I doing something wrong? Hope you can help. Thanks!



Related Questions


difficulties working with powershell Invoke-SQLCmd

Updated December 13, 2017 14:06 PM

sqlcmd access denied on c:/

Updated June 19, 2017 07:06 AM


SQLCMD does not prints Rows affected in log file

Updated November 03, 2016 09:02 AM

Messages in SQLCMD script output are not in order

Updated April 13, 2017 18:06 PM