Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 661
  • Last Modified:

Converting binary to int

I've got a SQL database which has a binary column containing a number (0 to 6). I want to use this number on an ASP page but what I get in the recordset doesn't seem tyo be any good.

I've tried selecting it as binary and also using CAST and CONVERT e.g. convert(int, status) but although the result can be output (e.g. response.write) I can't seem to use it in expressions. It behaves as null

Why How ... what do I do to get around it?
0
Dansimmo
Asked:
Dansimmo
  • 2
  • 2
2 Solutions
 
Duane LawrenceCommented:

convert(int, isnull(status,0))

Duane
0
 
LowfatspreadCommented:
how big is the binary column
can you post the Table ddl which created it...
0
 
Duane LawrenceCommented:
see if you have a lot of nulls in the column

select * from tablename where status is null

Duane
0
 
DansimmoAuthor Commented:
Its a very big table.

I checked and there aren't any nulls. The puzzling bit is that the ASP page seems to be able to print the value but when you multiply, add, concatenate or anything it behaves as if null.
0
 
DansimmoAuthor Commented:
sorry all ... big case of brain fade. wasn't  referring to recordset when multiplying etc. Free points!
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now