# Thread: first 4 number from BIGINT filed

1. Registered User
Join Date
Jul 2008
Posts
4

## Unanswered: first 4 number from BIGINT filed

Hello all,

I have 1 table in that 3 fields, and 3rd filed is INTIME and data_type is BIGINT

i am fire one query as follows:
select INTIME from table_name where ....

then Output =102390

But I want Output is 1023 i.e. only first 4 number

with warm Regards
Deepak
--;--;<@

2. Registered User
Join Date
Jan 2003
Posts
4,310
substr(char(intime),1,4)

Andy

3. :-)
Join Date
Jun 2003
Location
Posts
5,516
Or int(intime/100)

4. :-)
Join Date
Jun 2003
Location
Posts
5,516
Don't even need the int(), really.

5. Registered User
Join Date
Jul 2008
Posts
4

## Thanks

Thanks Very much

6. Registered User
Join Date
Jan 2003
Posts
4,310
Originally Posted by n_i
Or int(intime/100)
This will only work if the bigint is between 100000 and 999999. Any other numbers it will fail.

Andy

7. :-)
Join Date
Jun 2003
Location
Posts
5,516
True, but we're not dealing with just any numbers here: these are time values represented as numbers, if I understand the OP correctly, so the values will always be between 000000 and 235959

8. Registered User
Join Date
Jan 2003
Posts
4,310
Originally Posted by n_i
True, but we're not dealing with just any numbers here: these are time values represented as numbers, if I understand the OP correctly, so the values will always be between 000000 and 235959
If this is true, then it will fail for all times prior to 10 AM. This is 41% of the day.

Andy

9. :-)
Join Date
Jun 2003
Location
Posts
5,516
Well, I might have misunderstood the problem. I assumed that the value in INTIME represents time in the format of HHMMSS, and Mr. Deepak wants to extract just hours and minutes. If that's the case my approach would work correctly for any value.

However, if the time representation is somehow different, the SUBSTR() would be the right approach.

10. Registered User
Join Date
Jan 2003
Posts
4,310