This blog is about my history as a software engineer utilizing technologies C#, Java, React, JavaScript, .NET Core, SQL Server , Oracle, GIT, GitHub, Jira, Azure, AWS and HTML5. “I have not failed. I've just found 10,000 ways that won't work.” Thomas A. Edison. Please click on all my ADVERTISING links to help support this blog. Thank you.
Friday, October 25, 2013
Monday, October 07, 2013
SQL Random Number Generator
DECLARE @Random INT;
DECLARE @RandomChar CHAR(15);
DECLARE @Upper INT;
DECLARE @Lower INT
---- This will create a random number between 1 and 999
SET @Lower = 1 ---- The lowest random number
SET @Upper = 999 ---- The highest random number
SELECT @Random = ROUND(((@Upper - @Lower -1) * RAND() + @Lower), 0)
SET @RandomChar = (SELECT CAST(@Random AS CHAR(3)))
SET @srvc_code = 'New_Code-' + @RandomChar
DECLARE @RandomChar CHAR(15);
DECLARE @Upper INT;
DECLARE @Lower INT
---- This will create a random number between 1 and 999
SET @Lower = 1 ---- The lowest random number
SET @Upper = 999 ---- The highest random number
SELECT @Random = ROUND(((@Upper - @Lower -1) * RAND() + @Lower), 0)
SET @RandomChar = (SELECT CAST(@Random AS CHAR(3)))
SET @srvc_code = 'New_Code-' + @RandomChar
Subscribe to:
Posts (Atom)