troubleshooting Question

Cannot stop columns output from showing in ms sql result grid

Avatar of Stevie Zakhour
Stevie Zakhour asked on
Microsoft SQL ServerScripting LanguagesSQL* Stored Proc
2 Comments1 Solution114 ViewsLast Modified:
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

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
ASKER CERTIFIED SOLUTION
ste5an
Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros