Re: get the computer name (without the domain name)?

  • From: Roger Xu <wellmetus@xxxxxxxxx>
  • To: Igor Neyman <igor.neyman@xxxxxxxxx>
  • Date: Thu, 20 May 2010 10:30:37 -0500

Thanks! it works!


SQL> select SUBSTR(machine, INSTR(machine, '\') + 1) from v$session where
sid=41

;

SUBSTR(MACHINE,INSTR(MACHINE,'\')+1)

----------------------------------------------------------------

BB011499

SQL>


On Thu, May 20, 2010 at 10:06 AM, Igor Neyman <igor.neyman@xxxxxxxxx> wrote:

> Try:
>
> select SUBSTRING(machine, INSTRING('\') + 1) from v$session where sid=41;
>
> Igor Neyman
>
>
>
> On Thu, May 20, 2010 at 11:03 AM, Roger Xu <wellmetus@xxxxxxxxx> wrote:
>
>> Hi expert,
>>
>> How can I only get the computer name (without the domain name)?
>>
>> SQL> select machine from v$session where sid=41;
>> MACHINE
>> --------------------
>> Domain1\BB011499
>> SQL>
>>
>>
>> In UNIX, I would do this but I need it to be done inside SQL
>>
>> # echo 'Domain1\BB011499' | awk -F\\ '{print $NF}'
>> BB011499
>>
>> Thanks,
>>
>> Roger Xu
>
>
>

Other related posts: