Converting binary to int

Posted on 2004-11-18
Last Modified: 2012-06-27
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?
Question by:Dansimmo
    LVL 6

    Accepted Solution


    convert(int, isnull(status,0))

    LVL 50

    Assisted Solution

    how big is the binary column
    can you post the Table ddl which created it...
    LVL 6

    Expert Comment

    by:Duane Lawrence
    see if you have a lot of nulls in the column

    select * from tablename where status is null


    Author Comment

    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.

    Author Comment

    sorry all ... big case of brain fade. wasn't  referring to recordset when multiplying etc. Free points!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    In this article—a derivative of my blog post (—I will explore a few different perspectives on which week today's date falls within using Microsoft SQL Server. First, to frame this stu…
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
    Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now