How to split String value in sqlserver;
Example :
I want BE/CSE01 this is string
After Split the BE/CSE separate 01
01 Value Dynamic Increment 02
after this value add BE/CSE02
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jignesh TrivediRank #16 · 50.3K reputationPosted Sep 18, 2014, 9:20 PM EDT
I think your last question is same as
http://www.c-sharpcorner.com/Forums/Thread/269145/how-to-dynamic-increment-batch-id-in-sql-server-with-cur.aspx
Piyush PansuriyaRank #454 · 5.5K reputationPosted Sep 18, 2014, 1:09 AM EDT
this is the solution I have :
CREATE TABLE dbo.YourTable (ID INT IDENTITY(1,1), YourColumn AS 'BE/CSE' + CAST(ID AS VARCHAR(10)) PERSISTED, ...... )Jignesh TrivediRank #16 · 50.3K reputationPosted Sep 18, 2014, 3:44 AM EDT
hi,
very long but try....
select 'BE/CSE' + RIGHT('0000' + CAST(Cast(substring('BE/CSE01',7, LEN('BE/CSE01') - 5) as int) + 1 as varchar(10)),2)
also read my article
http://www.c-sharpcorner.com/UploadFile/ff2f08/auto-incremented-column-with-varchar-and-nvarchar-data-type/
hope this will help you.
Nirmal KumarCRank #6,413 · 267 reputationPosted Sep 18, 2014, 4:45 AM EDT
Your Source is very useful but i want more batches Dynamically Created.
Batches:
PSF/180
This is Batch for my database your source is only particular length only change dynamic Batch Id,But i want my side diff batchid available
ex:PSF/B180 ,ARPA/B146 ,RECP/B175 and CHEMCO/B73
this id also totally different. so how to get selected batchid wise incremennt value.
I want This below Result Batch wise select dynamically increment.
Example:
PSF/B1081 , ARPA/B146,RECP/B176, CHEMCO/B74
Thanks