Home All Groups Group Topic Archive Search About

TimeStamp as a String/VarChar

Author
30 Jun 2006 5:07 PM
sloan
I am passing xml into a stored procedure.

So I can handle 1 or more database updates in a single call.  (I already
know the pros and cons of this).

...

Well, I'm trying to work in some concurrency checking with the TimeStamp
method.

( the table has a definition for a timestamp, lets call it emptimestamp )

I pass the time stamp value up to the presentation layer.  Because I'm in a
web environment, I'm using a hidden tag, and converting the timestamp to a
string.

ex:
00-00-00-00-00-00-06-B7

I'd like to convert this back into a timestamp .. ~~inside the tsql code.
and use the value to check for concurrency.

since i'm using xml, i have to pass it in as an element

<xml>
<employees>
<employee>
    <empid>123</emp>
    <lastname>smith</lastname>
    <empTS>00-00-00-00-00-00-06-B7</empTS>
</employee>

<employee>
    <empid>234</emp>
    <lastname>jones</lastname>
    <empTS>00-00-00-00-00-00-06-BA</empTS>
</employee>

</employees>


Anybody know how to convert that stringByte .. back into a timestamp...
~with tsql code??

Author
30 Jun 2006 5:10 PM
sloan
PS

I'm still in sql server 2000.

Thus .Net code inside tsql is not possible yet.

...

My code to convert the timestamp to a string is:

private string ConvertToString(byte[] ts)

{

return BitConverter.ToString ( ts );

}






Show quote
"sloan" <sl***@ipass.net> wrote in message
news:eMFOChGnGHA.4572@TK2MSFTNGP05.phx.gbl...
>
> I am passing xml into a stored procedure.
>
> So I can handle 1 or more database updates in a single call.  (I already
> know the pros and cons of this).
>
> ..
>
> Well, I'm trying to work in some concurrency checking with the TimeStamp
> method.
>
> ( the table has a definition for a timestamp, lets call it emptimestamp )
>
> I pass the time stamp value up to the presentation layer.  Because I'm in
a
> web environment, I'm using a hidden tag, and converting the timestamp to a
> string.
>
> ex:
> 00-00-00-00-00-00-06-B7
>
> I'd like to convert this back into a timestamp .. ~~inside the tsql code.
> and use the value to check for concurrency.
>
> since i'm using xml, i have to pass it in as an element
>
> <xml>
> <employees>
> <employee>
>     <empid>123</emp>
>     <lastname>smith</lastname>
>     <empTS>00-00-00-00-00-00-06-B7</empTS>
> </employee>
>
> <employee>
>     <empid>234</emp>
>     <lastname>jones</lastname>
>     <empTS>00-00-00-00-00-00-06-BA</empTS>
> </employee>
>
> </employees>
>
>
> Anybody know how to convert that stringByte .. back into a timestamp...
> ~with tsql code??
>
>
>
Author
30 Jun 2006 6:50 PM
Alejandro Mesa
sloan,

See if this helps when pulling the timestamp value from sql server.

select master.dbo.fn_varbintohexstr(cast(timestamp as varbinary(8)))
go

AMB

Show quote
"sloan" wrote:

>
> PS
>
> I'm still in sql server 2000.
>
> Thus .Net code inside tsql is not possible yet.
>
> ...
>
> My code to convert the timestamp to a string is:
>
> private string ConvertToString(byte[] ts)
>
> {
>
> return BitConverter.ToString ( ts );
>
> }
>
>
>
>
>
>
> "sloan" <sl***@ipass.net> wrote in message
> news:eMFOChGnGHA.4572@TK2MSFTNGP05.phx.gbl...
> >
> > I am passing xml into a stored procedure.
> >
> > So I can handle 1 or more database updates in a single call.  (I already
> > know the pros and cons of this).
> >
> > ..
> >
> > Well, I'm trying to work in some concurrency checking with the TimeStamp
> > method.
> >
> > ( the table has a definition for a timestamp, lets call it emptimestamp )
> >
> > I pass the time stamp value up to the presentation layer.  Because I'm in
> a
> > web environment, I'm using a hidden tag, and converting the timestamp to a
> > string.
> >
> > ex:
> > 00-00-00-00-00-00-06-B7
> >
> > I'd like to convert this back into a timestamp .. ~~inside the tsql code.
> > and use the value to check for concurrency.
> >
> > since i'm using xml, i have to pass it in as an element
> >
> > <xml>
> > <employees>
> > <employee>
> >     <empid>123</emp>
> >     <lastname>smith</lastname>
> >     <empTS>00-00-00-00-00-00-06-B7</empTS>
> > </employee>
> >
> > <employee>
> >     <empid>234</emp>
> >     <lastname>jones</lastname>
> >     <empTS>00-00-00-00-00-00-06-BA</empTS>
> > </employee>
> >
> > </employees>
> >
> >
> > Anybody know how to convert that stringByte .. back into a timestamp...
> > ~with tsql code??
> >
> >
> >
>
>
>

AddThis Social Bookmark Button