I am currently using sp_user_counter1 to store database information on Perfmon, which can be recovered by AWS CloudWatch, but the values are Decimal, and the sp_user_counter1 parameter supplied must be an int.
So when I give the stored procedure a value of 12.34567 it report 12.00000 to the perfmon counter….
The sp code is:
CREATE PROCEDURE sys.sp_user_counter1 @newvalue INT AS
DBCC setinstance ('SQLServer:User Settable', 'Query', 'User counter 1', @newvalue)
Can I just call DBCC setinstance
and give it the decimal value???
I never tried this because I didnt found anyone doing this, I dont know the consequences….
Can this be done?? Is this secure??
Here is the User Setabble documentation:
https://msdn.microsoft.com/en-us/library/ms187480.aspx
Best Answer
Running this:
results in:
Running the following shows you the "help" entry for the
DBCC setinstance
:This returns:
Unfortunately, that is no help determining if
value
can only be an int.In fact, the MSDN page you linked states the following: