Generate Alpha Numeric no in sql server
-
Hi I want to generate alpha numeric no like this: If I say length is 4 it generates like 0001 0002 0003 --- --- --- 9999 A001 A002 --- --- --- A999 B001 --- --- zzzz Please help Thanks in advance
You might be able to do something like this with two columns. Put a normal running number in one column and then populate the other column based on the value in the first one: Col 1 Col 2 1 0001 ... 999 0999 ... 9999 9999 10000 A001 etc.
My advice is free, and you may get what you paid for.
-
Hi I want to generate alpha numeric no like this: If I say length is 4 it generates like 0001 0002 0003 --- --- --- 9999 A001 A002 --- --- --- A999 B001 --- --- zzzz Please help Thanks in advance
If you want to generate the data on-the-fly, you could use table valued functions. Here's one example: Using Table-Valued Functions in SQL Server[^]
The need to optimize rises from a bad design.My articles[^]
-
Hi I want to generate alpha numeric no like this: If I say length is 4 it generates like 0001 0002 0003 --- --- --- 9999 A001 A002 --- --- --- A999 B001 --- --- zzzz Please help Thanks in advance
SELECT CAST(RAND() * 1000 AS VARCHAR) AS [Random_Number]