Trouble with Timestamp Datatype

Results 1 to 2 of 2

Thread: Trouble with Timestamp Datatype

  1. #1
    Join Date
    Dec 1969

    Default Trouble with Timestamp Datatype

    I&#039;m having a problem reading in the timestamp datatype from SQL Server. I know that it is a binary type. I am using it to make sure no changes have been made to the database. I need to be able to read this value from the database and then send it back to compare against the value in the database.<BR><BR>Can any one help me?

  2. #2
    Mitch Greess Guest

    Default RE: Trouble with Timestamp Datatype

    &nbsp;<BR>I ran into the same problem. I was trying to figure out a way to save the timestamp passed back in a recordset from a select stored procedure, and then pass the timestamp back as a parameter to an update stored procedure. The only way I was able to do this was to convert the timestamp to an ascii string and save it in a hidden input field in my ASP form. When the user clicks SAVE in the form, the server side code constructs an ADO command of type TEXT and constructs the stored procedure call as a string passing the TIMESTAMP string as a parameter. In the stored procedure, the corresponding parameter is defined as type TIMESTAMP. Doing it this way, SQL is able to convert the string into a TIMESTAMP. When I tried to define the relevant parameter as a CHAR or VARCHAR and then convert it to a TIMESTAMP in the stored procedure, SQL Server threw an error even thought the documentation say you can do that. I never figured out why<BR><BR>Here&#039;s the code to convert a TIMESTAMP to a string:<BR><BR><BR>Private Function TSToHex(aValue() As Byte) As String<BR> Dim sBuffer As String<BR> Dim b As Integer<BR><BR> sBuffer = "0x"<BR> For b = LBound(aValue) To UBound(aValue)<BR> sBuffer = sBuffer + Right("00" & Hex(aValue(b)), 2)<BR> Next<BR> TSToHex = sBuffer<BR>End Function

Posting Permissions

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