Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
0
Reply
i want to check which is greater value get
Nirmal KumarC
Oct 3 2014 9:51 AM
584
Reply
i want my query two values get table different id with same date,so i want this two value which one greater than record
select
@EID
= count(ltrim(rtrim(ltrim(isnull(BI.EID,''))))) from BATCHID BI,CO_BATCH_MASTER CBM where bi.BID = CBM.cbm_batch_id and bi.B_ACTIV<>'D' and CBM.cbm_active<>'D'
and cbm.cbm_batch_start_dt < @cbm_batch_start_dt and CBM.cmn_minor_code=@cmn_minor_code
while loop or if condition using this id get
above Query codewise
more than one time this batchid came means i will get Below two values .
BatchID:
ARPA/B
147
ARPA/B
148
after this two values below code wise separate only integer value get 147,148 this two value which one greater.
Example:
above Query get @EID value.
Declare @strAlphaNumeric varchar (50)
Declare @intAlpha INT
SET @strAlphaNumeric=@EID
SET @intAlpha = PATINDEX('%[0-9]%', @strAlphaNumeric)
select Cast(SUBSTRING(@strAlphaNumeric,@intAlpha, len(@strAlphaNumeric)) as int)
select SUBSTRING(@strAlphaNumeric,1,@intAlpha-1)
This code get it
ARPA/B
147
this
value after loop is running
ARPA/B
148
this value get but different date
Running the above code shows output as follows
147
148
ARPA/B
ARPA/B
thanks
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
from my code i want to check which is greater
How to get highest id in same date with different id ?