How to use random(1,26) in insert while insert random character

Database
Enthusiast

How to use random(1,26) in insert while insert random character

insert into table_name(column_name)values(upper(substring('abcdefghijklmnopqrstuvwxyz' from random(1,26) for 1)))

where column_name is in varchar(50) datatype

its throwing error as
Random not allowed in inserted PI column value

pls help me in resolving this
1 REPLY
Junior Contributor

Re: How to use random(1,26) in insert while insert random character

Replace values with select

insert into table_name(column_name)
select upper(substring(' abcdefghijklmnopqrstuvwxyz' from random(1,26) for 1))

Dieter