Generating random string in T-SQL

Possible Duplicate:
Generating random strings with T-SQL

I need to generate a random string with alpha and numeric characters inside a trigger.

  • T-SQL fulltext catalog search with freetext
  • SQL Server “not exists” on unique key attempts to insert rows?
  • Dynamically joining tables that may not exist
  • How to convert bit column to int
  • SqlBulkCopy.WriteToServer() keep getting “connection is closed”
  • PHP Apache SQL Server production environment on OS X
  • The string must have a length of 15 and uppercase.

    Someone have an idea?

  • Element Present in One group must present with other too
  • SQL SERVER Procedure Inconsistent Performance
  • Select count from three tables and group by one field
  • Cross join on condition
  • Which one to use? EAV or Blobs in the database?
  • I don't know what is wrong with this code
  • 2 Solutions collect form web for “Generating random string in T-SQL”

    This is far from an optimal solution, but it will work as specified:

    select char(rand()*26+65)+char(rand()*26+65)+char(rand()*26+65)
          +char(rand()*26+65)+char(rand()*26+65)+char(rand()*26+65)
          +char(rand()*26+65)+char(rand()*26+65)+char(rand()*26+65)
          +char(rand()*26+65)+char(rand()*26+65)+char(rand()*26+65)
          +char(rand()*26+65)+char(rand()*26+65)+char(rand()*26+65)
    

    Example output:

    WCZOVRCIRELAJUT
    

    generate a GUID and take just the first 15 characters?

    Generate a bunch of random numbers and translate to their ASCII values?

    MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.