SQL make random string


/ Published in: SQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. DECLARE @ID INT = 10000
  2. while @ID < 10010
  3. BEGIN
  4. DECLARE @location VARCHAR(1000) = ''
  5. DECLARE @i INT = 0
  6. while @i<1000
  7. BEGIN
  8. SET @location = @location + CHAR(33 + CAST(CEILING(rand() * 80) AS INT))
  9. SET @i = @i+1
  10. END
  11.  
  12. SELECT @location
  13. SET @ID = @ID +1
  14. END

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.