Link to home
Create AccountLog in
Avatar of hoffmanconsultingllc
hoffmanconsultingllcFlag for United States of America

asked on

Correct TSQL Syntax for sp_spaceused

Hello,

I am trying to write a 2008 R2 query that will only bring back the data portion related to how much space a particular table is using in an SQL DB. Below you see the string i use and the returned data. I only need the data column and cannot figure out how to format the query, ideally it would return the result in GB or MB.

User generated image
SOLUTION
Avatar of Adam
Adam
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Zberteoc
You can't execute a procedure from a function, especially a system one. You can put Cyber-spy's code in a stored procedure to create that table. You execute the procedure followed by the select * from
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of hoffmanconsultingllc

ASKER

Thanks much these will work great!!!