Displaying binary field contents?

Results 1 to 7 of 7

Thread: Displaying binary field contents?

  1. #1
    Hud Guest

    Default Displaying binary field contents?

    Is it possible to display binary field values? If so, how. Specifically, timestamp fields are binary. And I want to show their contents. There must be a way, otherwise, why use timestamp at all? (I did not design the database, alas, or I would have made them datetime).

  2. #2

    Default RE: Displaying binary field contents?

    In ASP, generic data from Databases are Variants - they are not specific data types UNTIL you explicitly convert them. Thus, SQL Server will store a timestamp file as binary, but once ADO reads it into the ASP environment, its a variant...so just response.write <<column name>>

  3. #3
    HUd Guest

    Default Nope

    Maybe it&#039;s supposed to do that, but it doesn&#039;t. It gives me a type mismatch when I try to display it either by moving it into a variable, a straight =rs("timestamp") display. And I tried CDATE and a bunch other techniques. <BR><BR>We&#039;re using NT 4, IIS 4 and SQL 7.

  4. #4

    Default RE: Nope

    try response.binaryWrite(yourField)

  5. #5
    Hud Guest

    Default Huh--It kind of worked, sort of

    I didn&#039;t know about binarywrite. I should read my books more. :)<BR><BR>Anyway, it displayed this: -lj<BR><BR>Shouldn&#039;t it be time stamp data? Is there a conversion needed somewhere?

  6. #6
    Join Date
    Dec 1969

    Default RE: Huh--It kind of worked, sort of

    Response.BinaryWrite is normally used to output graphics. It simply takes the 8 bytes in that timestamp value and sends them unmodified to the output. <BR><BR>Well, the fact that this worked indeed shows that what you have is a binary field. In VARIANT terms, you have an array of UI1 data. I have no idea how to convert this to something else using standard VBS (or JS) conversions. I think the basic problem is that this particular VARIANT is not supported as a variable type by the scripting engines. Dunno what to tell you!<BR><BR>Incidentally, if you read the TSQL docs carefully, you will see that "timestamp" is *NOT* necessarily related to time-of-day. It is perfectly possible (and even likely) that it is implemented instead as simply a monotonically increasing number that uses 8 bytes only to guarantee that it will be unique within the expected life of the universe. (That is, each time a timestamp in a given DB is generated, it simply gets the next number in sequence...and there are roughly 16,000,000,000,000,000,000 available numbers.)<BR><BR>

  7. #7
    Hud Guest

    Default RE: Huh--It kind of worked, sort of

    Yeah, it&#039;s annoying. I don&#039;t see the point in such a field if it can&#039;t dive you a date and/or date/time unless all you care about is sequencing. The record ID usually does that. <BR><BR>Whatever....<BR><BR>Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts