string representation of binary to integer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pb2000
    New Member
    • Apr 2010
    • 13

    string representation of binary to integer

    Hello,

    I struggle with really odd matter:
    There is sth like '01010101' which is needed as an integer on function output. Is it possible to convert it (string representation of binary to integer)?
    I tried ::byte and get_bytes(), without any success.

    Can You help me? Thanks a lot!
    pb2000
  • rski
    Recognized Expert Contributor
    • Dec 2006
    • 700

    #2
    try like that
    Code:
    select ('01010101'::bit(8))::integer;

    Comment

    • blexfort
      New Member
      • Mar 2019
      • 1

      #3
      Great! Thank you! It works in PostGreSQL.

      Comment

      Working...