Scripts

Technical Article

faster dbo.ufn_vbintohexstr - varbinary to hex

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 […]

You rated this post out of 5. Change rating

2006-12-20 (first published: )

104 reads

Technical Article

BASE64 Encode and Decode in T-SQL - optimized

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, […]

4.8 (5)

You rated this post out of 5. Change rating

2006-12-18 (first published: )

7,333 reads

Technical Article

HexToInt

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 […]

You rated this post out of 5. Change rating

2006-12-15 (first published: )

186 reads

Technical Article

SQLStackEngine - simulate a character stack

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 […]

You rated this post out of 5. Change rating

2006-12-12 (first published: )

140 reads

Technical Article

Search for an expression in the body of programmable objects

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 […]

You rated this post out of 5. Change rating

2006-11-30 (first published: )

169 reads

Technical Article

Remove Exec Permissions To Extended Stored Procs

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 […]

5 (1)

You rated this post out of 5. Change rating

2006-11-27 (first published: )

604 reads

Blogs

Webcast Tomorrow on SQL Server Disaster Recovery

By

Tomorrow, November 19, 2024, at 1 PM EST, I'm giving a webcast on SQL...

SQL Server Quickie #48 – Azure SQL Managed Instance

By

Today I have uploaded SQL Server Quickie #48 to YouTube. This time I’m talking...

Spark Connect Dotnet November 2024 Where are we?

By

All Spark Connect Posts Introduction There have been quite a few changes in the last...

Read the latest Blogs

Forums

How much transaction logs generated by hourly/daily

By JasonO

For MSSQL is there any queries or methods for me to pull historical data...

A Design Question using a fictious example

By eichnerm

Background: I have two tables. Tests and Grades. For each Tests record there are...

GBL wheel cleaner online supplier in Sussex UK.

By papucong

mathiasbrock111@gmail.com Buy GHB powder online, Buy GBL alloy wheel cleaner in Wolverhampton WhatsApp+237656193417 Buy...

Visit the forum

Question of the Day

What's the Ceiling?

What do I get as the results from this code?

SELECT CEILING (999.999), CEILING (-999.999);

See possible answers