Thulasiram pakala

Thulasiram pakala

  • 771
  • 872
  • 116.9k

Sql Increment Issue

May 8 2019 2:18 AM
hi i want to increment sr no like
 
INI/DE/2019-20/kah10990/1
INI/DE/2019-20/kah10990/2
in this i pass INI/DE/2019-20/kah10990/ this values code side
i am using this query its work
 
Select isnull(max(substring(uid,24,len(uid)-23)),0)+1 as Uid from tblinstinward where  emlyear='2019-20'  and instid='kah1099'
 
but sometimes this   institute id len will be changed (kah10990) like (kah10990012) like
INI/DE/2019-20/kah1099011/1    like this so in this type of insert time this query is not working
 

Answers (3)