I need to insert data to table #t with incremental by 1
so max id for records on #t is 3 so
if i insert multi rows as 4 rows to table #t then it must take 4,5,6,7
but this not happen all records take 4
so how to solve this issue please
i don't need use identity column so how to increment every row by 1 without using identity column
so how to do that please
create table #t
(
id int,
name nvarchar(20)
)
insert into #t(id,name)
values
(1,'ahmed'),
(2,'ali'),
(3,'ala')
create table #t2
(
name nvarchar(20)
)
insert into #t2(name)
select 'islam'
union
select 'sayed'
union
select 'wahdan'
union
select 'warshan'
what i try
insert into #t(id,name)
select (select isnull(max(id)+1,0) from #t ),name from #t2
expected result