0

I am firing a SQL query through command prompt

 H:\>sqlcmd -S cx-siscsqltest\sqlinst  -Q "select serverproperty('servername'), serverproperty('Edition'), SERVERPROPERTY('ProductVersion'), SERVERPROPERTY('Productlevel') "

The output is returning huge spaces, can you please help me remove those spaces? I have to use this output in xml

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
deepti
  • 729
  • 4
  • 17
  • 38
  • https://stackoverflow.com/questions/10561961/formatting-output-in-sqlcmd-mode or https://stackoverflow.com/questions/33738433/how-to-format-sqlcmd-output maybe –  Jul 13 '17 at 11:43
  • Please provide an example of what you mean by "The output is returning huge spaces". – underscore_d Jul 13 '17 at 11:43
  • Have you tried casting your result to a smaller NVARCHAR ? – Jens Jul 13 '17 at 11:46
  • Note that SQL Server has full support for XML (`FOR XML AUTO`, `FOR XML PATH`) so you may be able to get the result you're after without further formatting. – Jeroen Mostert Jul 13 '17 at 11:47
  • @underscore- above command returns 4 col and 1 row , each data occupies 100 lines – deepti Jul 13 '17 at 11:49

0 Answers0