It is not a good idea to do this. It is difficult to program, and would limit the scalability of your system.
If you really need to display data this way, for example, in reports, you can add a simple conversion in a view and use that.
create table T_RENTAL
(
RENTAL_ID int not null identity(1,1) primary key clustered,
COL_1 int
)
go
create view V_RENTAL
as
select
RENTAL_REPORT_ID = 'R'+right('0000000'+convert(varchar,RENTAL_ID),7),
RENTAL_ID,
COL_1
from
T_RENTAL
go
insert into T_RENTAL (COL_1)
select
COL_1 =NUMBER
from
F_TABLE_NUMBER_RANGE(101,110)
select * from V_RENTAL
go
drop table T_RENTAL
drop view V_RENTAL
Results:
(10 row(s) affected)
RENTAL_REPORT_ID RENTAL_ID COL_1
---------------- ----------- -----------
R0000001 1 101
R0000002 2 102
R0000003 3 103
R0000004 4 104
R0000005 5 105
R0000006 6 106
R0000007 7 107
R0000008 8 108
R0000009 9 109
R0000010 10 110
(10 row(s) affected)
CODO ERGO SUM