sqlwatch icon indicating copy to clipboard operation
sqlwatch copied to clipboard

SQLWATCH 4.3: usp_sqlwatch_logger_disk_utilisation: sp_spaceused returns non-numeric data

Open kekcjkee opened this issue 2 years ago • 2 comments

Describe the bug

insert into @spaceused
	exec [dbo].[usp_sqlwatch_internal_foreachdb] @command = 'use [?]; exec sp_spaceused @oneresultset = 1;'
		, @snapshot_type_id = @snapshot_type_id
		, @calling_proc_id = @@PROCID
		, @databases = @databases

The script for my one database returns resultset which contains nvarchar symbols "*". During execution procedure "usp_sqlwatch_internal_foreachdb" returns the error:

Msg 8114, Level 16, State 5, Procedure usp_sqlwatch_logger_disk_utilisation, Line 215 [Batch Start Line 0]
Error converting data type varchar to numeric.

I think it depends on size of a database. In my case it is 30T. (Yes, it is test env :) )

Screenshots image image

Windows Server (please complete the following information):

  • OS Version: Windows Server 2019 Datacenter 10.0

SQL Server (please complete the following information):

  • SQL Version: SQL Server 2016 (SP3-CU1-GDR) (KB5015371) - 13.0.7016.1 (X64)
  • SQL Edition: Developer Edition

SQL Server Management Studio (SSMS -> about -> copy info): SQL Server Management Studio 15.0.18410.0 SQL Server Management Objects (SMO) 16.100.47008.0+9f71e8549924d85d66afcca2b9f45a33061faa1b Microsoft Analysis Services Client Tools 15.0.19750.0 Microsoft Data Access Components (MDAC) 10.0.20348.1 Microsoft MSXML 3.0 6.0 Microsoft .NET Framework 4.0.30319.42000 Operating System 10.0.20348

SQLWATCH version (from DACPAC or from sysinstances)

  • 4.3.0.0

kekcjkee avatar Aug 09 '22 08:08 kekcjkee

Hi, Can you help me fix this? I don't have 30TB db in my test setup :). What do you think the problem is?

marcingminski avatar Oct 22 '22 22:10 marcingminski

Hi, Can you help me fix this? I don't have 30TB db in my test setup :). What do you think the problem is?

Hi, I recently left a company where I managed a 30TB database. Initially, I thought that sp_spaceused utilized an int variable, but that turned out to be incorrect. I'm not sure why it doesn't work.

kekcjkee avatar Apr 29 '23 09:04 kekcjkee