June 28, 2002 at 6:16 pm
Hi everyone,
How can I check the size of each table and index in my database? Thanks in advance for your help.
July 2, 2002 at 10:34 am
Try: sp_spaceused Table_name
July 3, 2002 at 5:14 am
sp_msforeachtable 'sp_spaceused ''?'''
July 3, 2002 at 11:46 am
Thanks guys, I liked both answers, but the sp_msforeachtable can be very handy.
One more question:
How can I check the full text of the sql statement that is being run. In other words, I have a SPID and I want to see the full sql for that SPID. How can I see that? Thanks again.
July 3, 2002 at 11:48 am
DBCC INPUTBUFFER() will give you the last statement executed.
or use Profiler to capture statements as they happen.
K. Brian Kelley
http://www.sqlservercentral.com/columnists/bkelley/
K. Brian Kelley
@kbriankelley
July 3, 2002 at 12:04 pm
OK, here is why I need to get the full text for each SPID.
I wrote stored procedure that will give me the amount of CPU and I/O used over a period of time. So, basically, if a process is using a lot of CPU and/or I/O, I can see it. For this reason, I like to also add to my stored procedure a column that has the FULL sql statement that is being run for each SPID. EM only shows you part of the sql statement, which is not good for performance tuning of sql statements.
So, I need to the full sql statement because:
1. It is more convenient to have everything in my procedure instead of taking the SPID from my procedure and checking the sql statement in EM.
2. EM only gives me partial sql statements, which does not allow me to do sql performance tuning.
Any ideas where the sql statements are stored? Thanks again guys.
July 3, 2002 at 2:32 pm
Profiler will capture all this information. Save the information to a trace file. Then, in order to analyze it, open up your trace file and save it to a trace table.
K. Brian Kelley
http://www.sqlservercentral.com/columnists/bkelley/
K. Brian Kelley
@kbriankelley
July 3, 2002 at 2:47 pm
Profiler would be a better solution for tracking usage over some time period.
Steve Jones
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply