Comment on Usp_FindAllDBSizes
This is a comment on/modification of the Usp_FindAllDBSizes script on Sept 17th.Why use an inner loop when you can use a select stmt?
2003-09-17
121 reads
This is a comment on/modification of the Usp_FindAllDBSizes script on Sept 17th.Why use an inner loop when you can use a select stmt?
2003-09-17
121 reads
We can know how much space a database is occupied in hard disk by using sp_spaceused function. If we want to find all database sizes at a time, we have to provide use and sp_spaceused for all databases. It takes some time to write all those T-sql statments. My script will find each and every […]
2003-09-16
1,681 reads
SQL Server includes the COUNT function for counting a table's rows - however, it can be slow. Although querying the "rows" column from the sysindexes table is faster, it is not always accurate (e.g., if a bulk load process has recently taken place). In addition, you would not be able to use this method in […]
2003-09-11
444 reads
This a modification to the script given by eugene_b.It generates prime numbers to the upper bound you specify.I have done some simple modifications to speed the process
2003-09-10
155 reads
2003-09-08
599 reads
Following on from todays QOD (on xp_cmdshell permissions) I thought this might be useful.Takes a directory or UNC path and returns the contents as a table. eg:exec sp_getdir '\\mypc\c$'returns:datestring timestring directory filesize nameoffile---------- ---------- ----------- ----------- ----------------------18/07/2003 10:45 1 NULL Documents and Settings18/07/2003 11:02 […]
2003-09-04
287 reads
This query will give you the current job status of all scheduled jobs on sql server. Just by using sysJobs, and sysJobHistory table you will get to know the details about the last status of the scheduled jobs, irrespective of their status like failed, successful, or cancelled.Note: You must have admin right on MSDB database […]
2003-09-04
8,583 reads
This UDF is using in reporting where lots of durations are calculated, stored and then summed up and averaged for reports. By storing the durations as floats (which are similar to the fixed point numbers datetimes are stored as) math functions are simpler.The problem is that float-times are not human readable, and cast(@floatime as datetime) […]
2003-09-03
1,023 reads
With a dynamic sql script under 4000 chars use sp_executesql With under 8000 chars write it to a variable.For anything longer you can use this script. Use UpdateText and WriteText to write your dynamic sql to a text/ntext field in a table somewhere and then pass its location to this script.
2003-09-01
623 reads
I wrote this to allow me to send a priority list of int ids.This takes a "," seperated list of integers and puts them into a table, along with an [insorder] field that allows you to sort them.eg 2,6,3,1,7 becomesints insorder ---- --------1 72 13 56 37 9Depending on what […]
2003-09-01
99 reads
When I put together the invitation for T-SQL Tuesday #202, I wasn't sure what...
By Steve Jones
My life has some crazy travel stretches for sure. Between speaking, office visits, customer...
In Part 1, we saw how ‘Vamana’ represents vectors as nodes, connects them with...
Comments posted to this topic are about the item Server-Level Table sizes
Comments posted to this topic are about the item Optional Parameter Plan Optimization in...
There is a table tmp_tab:
CREATE TABLE tmp_tab ( id int, val int );
INSERT INTO tmp_tab VALUES (1, 1), (2, NULL), (3, 3), (4, 4), (5, 5);You want to order the rows ids by the following expression:
ISNULL(val, id) + 1Which of the following queries produces the expected ordering and why? (Select all correct) See possible answers