Avatar of Stevie Zakhour
Stevie Zakhour
 asked on

Cannot stop columns output from showing in ms sql result grid

Hi Guys

I'm trying to understand why the function "set nocount on" does not work in my MS SQL stored procedure script called [GetScore], see below

	declare @JSON		varchar	(max )
	declare @cmd		varchar	(100 )
	declare @cmd1		varchar	(8000)
	declare @deletefile varchar	(20	 )


	set @deletefile='LastScore.txt' 
	set @cmd= 'xp_cmdshell ''del "d:\Freak\' + @deletefile + '"''';
	set @cmd1 = ' ren d:\Freak\*.txt LastScore.txt'
	
        set nocount on
	exec master..xp_cmdshell @cmd1


	waitfor delay '00:00:01';

	select @JSON = BulkColumn from openrowset (bulk 'D:\Freak\LastScore.txt', single_clob) as j

	select * from openjson (@JSON) with 

	(
		LeaderboardName					varchar		(20)
	   ,LeaderboardNameFull				varchar		(20)
	   ,PlayerCount						varchar		(20)
	   ,PlayerName						varchar		(20)
	   ,Score							nvarchar	(20)
	   ,ZombiesKilled					varchar		(15)		'$.ScoreDetails.ZombiesKilled'
	   ,Accuracy						varchar		(50)		'$.ScoreDetails.Accuracy'
	   ,DamageTaken						varchar		(20)		'$.ScoreDetails.DamageTaken'
	   ,SecondsInLevel					varchar		(30)		'$.ScoreDetails.SecondsInLevel'
	   ,Deaths							varchar		(50)		'$.ScoreDetails.Deaths'
	)

	waitfor delay '00:00:01';

        set nocount on
	exec (@cmd)


	go

Open in new window


When I run the stored procedure [GetScore] I get 2 columns called Output, I don't know how to stop these columns from showing up in the result. I have attached a snip of the result after running the stored procedure, see below

Snip20200203_6.png
Any help is greatly appreciated
Microsoft SQL ServerScripting LanguagesSQL* Stored Proc

Avatar of undefined
Last Comment
Stevie Zakhour

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
ste5an

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Stevie Zakhour

ASKER
Thanks St5an, that worked!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy