Here's an alternative to Clinton Herring's ufn_vbintohexstr which should be much faster with large varbinary values. First, in his original version, the inner-loop CASE statements can be replaced with this: select @value = @value + CHAR(@vbin/16+48+(@vbin+96)/256*7) +CHAR(@vbin&15+48+((@vbin&15)+6)/16*7) How does it work? By adding 6 to a hex-digit in (@vbin&15), you have a value from 16 […]
2006-12-20 (first published: 2005-05-07)
104 reads
This script sets the recovery model for all databases to simple. It also truncates the log files before shrinking the databases.
2006-12-19 (first published: 2005-06-03)
321 reads
This is just an optimized version of Daniel Payne's two scripts, base64_encode and base64_decode, with changes to end-of-block handling and a bug fix or two. If the encoded string ends in =, the last character is truncated. If ending in ==, two characters are chopped off. That seems better than replacing NUL characters with spaces, […]
2006-12-18 (first published: 2005-06-04)
7,333 reads
Challenged by Hans Lindgren's stored procedures of the same name, I created this. Note that it produces strange results on non-hexadecimal strings, overflows at 0x80000000, and could have issues with byte-ordering on some architectures.How does it work? Well, the distance between one after '9' (':') and 'A' is 7 in ASCII. Also, if I subtract […]
2006-12-15 (first published: 2005-05-04)
186 reads
SQLStackEngine - simulate a character stack using a string. This script was developed specifically to support the operator stack in SQLCalcEngine(also on this site). However, the implementation is complete enough to stand on its own.There are several functions in the package that correspond to the common stack functions of Push, Pop, Peek, and so on.In […]
2006-12-12 (first published: 2004-06-22)
140 reads
Sometimes you want to modify an object (like a stored procedure, Function, trigger and view) and you can not remember the name of that object, but you remember some words of the comments that you placed in the body of that object. If this is your case, you can use the following procedures depending on […]
2006-11-30 (first published: 2006-01-10)
169 reads
Drops the specified column from the specified table as well as any constraints that depend on the column. By default the script will just find the corresponding column and constraints.Comes in handy for patching databases.
2006-11-29 (first published: 2006-05-17)
951 reads
Determine the rate of database growth over a period.
2006-11-28 (first published: 2006-10-11)
555 reads
I created this script to simplify the process of restricting access to high risk extended stored procedures. It will find any user or role which has execute permissions on any of the stored procedures in the "#High_Risk_Stored_Procs" temp table and will generate the relevant revoke statements to remove those permissions.The current list of stored procedures […]
2006-11-27 (first published: 2006-11-07)
604 reads