TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nirmal KumarC
NA
327
79.6k
i want to check which is greater value get
Oct 3 2014 9:51 AM
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
Reply
Answers (
0
)
from my code i want to check which is greater
How to get highest id in same date with different id ?