I want How to weekly wise one time all batches as Batch id dynamic increment using Sql server with cursor example below.
Batches Example:
Batches:
PSF/180
ERS/B366
ARPA/B146
EFA/B989
PSSR/B1096
RECP/B175
CHEMCO/B73
ERS/B367
So this All Batch id Dynamically get this result in below
I want ARPA/B146 get data to database
After Split the ARPA/B separate 146
146 Value Dynamic Increment 147
after this value ARPA/B147 insert Batchid to database this result
another one Example: PSSR/B1096 this id dynamically create PSSR/B1097
Thanks
Loading

Jignesh TrivediPosted Sep 18, 2014, 11:58 PM
Hi,
using PATINDEX, you can achieve this.
try....
Declare @strAlphaNumeric varchar (50) = 'EFA/B989 '
DECLARE @intAlpha INT
SET @intAlpha = PATINDEX('%[0-9]%', @strAlphaNumeric)
select Cast(SUBSTRING(@strAlphaNumeric,@intAlpha, len(@strAlphaNumeric)) as int)
select SUBSTRING(@strAlphaNumeric,1,@intAlpha-1)
hope this will help you.
Nirmal KumarCPosted Sep 19, 2014, 3:21 AM
Thanks