Skip to content

Instantly share code, notes, and snippets.

@ststeiger
Last active August 29, 2015 14:09
Show Gist options
  • Save ststeiger/662da186bf9543fee09d to your computer and use it in GitHub Desktop.
Save ststeiger/662da186bf9543fee09d to your computer and use it in GitHub Desktop.
Generate pseudo-random key-inventory-hook-number in Range 0-999 with 4 digits 0-padding
SELECT
RIGHT('0000' + CAST(ABS(CHECKSUM(T_KeyGroup.KG_No + '.' + T_Key.Key_No)) % 1000 AS varchar(10)), 4) AS RPT_Hook
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment