Search
 
SCRIPT & CODE EXAMPLE
 

SQL

random name function in mysql for nvarchar

INSERT INTO vehicles VALUES (blah); -- leaving out the number plate
SELECT @lid:=LAST_INSERT_ID();
UPDATE vehicles SET numberplate=concat(
  substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@lid)*4294967296))*36+1, 1),
  substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1),
  substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1),
  substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1),
  substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1),
  substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1),
  substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed:=round(rand(@seed)*4294967296))*36+1, 1),
  substring('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', rand(@seed)*36+1, 1)
)
WHERE id=@lid;
Comment

PREVIOUS NEXT
Code Example
Sql :: temp table sql 
Sql :: what is integrity constraints 
Sql :: update field sql 
Sql :: round one decimal place mysql 
Sql :: install postgresql centos 5 
Sql :: install mysql in ubuntu 
Sql :: postgresql extract hour and minutes from timestamp 
Sql :: sql update null values 
Sql :: how to get duplicate records with multiple field in sql 
Sql :: postgres copy table from one schema to another 
Sql :: MYSQL select last query 
Sql :: update mongodb version ubuntu 
Sql :: sql count distinct group by 
Sql :: change database name psql 8 
Sql :: postgres cast as decimal 
Sql :: pl/sql cursor 
Sql :: check constraint in sql 
Sql :: enable sql server full text indexing 
Sql :: oracle nextval 
Sql :: 3 days back in sql server 
Sql :: how to create a table in mysql 
Sql :: sql get month from date 
Sql :: mysql dump specific tables 
Sql :: sqlite autoincrement 
Sql :: space not removing from column in sql 
Sql :: oracle get running queries 
Sql :: add column postgres with default value 
Sql :: add a day big query 
Sql :: desc in sql 
Sql :: mysql check date range 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =