[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.sqlserver.programming

How to update varbinary field

SQLFriend

3/28/2007 2:16:00 PM

Hi I have a varbinary datatype field thta I would like to update, can anyone
please show me how to do it. What is the syntax that I can use to run on
Query Analyzer to update the varbinary field?
Thanks
7 Answers

Russell Fields

3/28/2007 2:36:00 PM

0

create table #x (a varbinary(8))
insert into #x (a) values (0x123AAA)
select * from #x
update #x set a = 0xFFF888
select * from #x

drop table #x

RLF

"SQLFriend" <SQLFriend@discussions.microsoft.com> wrote in message
news:D108EF9B-1333-4A54-AD4F-CEDC68B9D819@microsoft.com...

> Hi I have a varbinary datatype field thta I would like to update, can
> anyone
> please show me how to do it. What is the syntax that I can use to run on
> Query Analyzer to update the varbinary field?
> Thanks


SQLFriend

3/28/2007 3:04:00 PM

0

Russell,
Here is what I am trying to do:
Field1 is varbinary(256),Field2 is nvarchar(50)
I want to update the value of Field1 with the value of Field2
If I try the following code, will field2 value be saved in field1 as
varbinary?
"Update tblName SET Field1 = CONVERT(varbinary,Field2) Where
Field3 = 1"
Thanks




"Russell Fields" wrote:

> create table #x (a varbinary(8))
> insert into #x (a) values (0x123AAA)
> select * from #x
> update #x set a = 0xFFF888
> select * from #x
>
> drop table #x
>
> RLF
>
> "SQLFriend" <SQLFriend@discussions.microsoft.com> wrote in message
> news:D108EF9B-1333-4A54-AD4F-CEDC68B9D819@microsoft.com...
>
> > Hi I have a varbinary datatype field thta I would like to update, can
> > anyone
> > please show me how to do it. What is the syntax that I can use to run on
> > Query Analyzer to update the varbinary field?
> > Thanks
>
>
>

Russell Fields

3/28/2007 3:30:00 PM

0

SQLFriend,

Sure, that works fine for me on SQL Server 2000 and 2005.

I would recommend more fully specifying to:
CONVERT(varbinary(256), Field2)

The NVARCHAR(50) should take a max of VARBINARY(100). However, if you
overflow the space needed to a conversion, you will get an error message.
Including the size in the CONVERT is a safety net.

RLF

"SQLFriend" <SQLFriend@discussions.microsoft.com> wrote in message
news:901C4A49-6F15-4BCC-AC75-D97B1152A955@microsoft.com...
> Russell,
> Here is what I am trying to do:
> Field1 is varbinary(256),Field2 is nvarchar(50)
> I want to update the value of Field1 with the value of Field2
> If I try the following code, will field2 value be saved in field1 as
> varbinary?
> "Update tblName SET Field1 = CONVERT(varbinary,Field2) Where
> Field3 = 1"
> Thanks
>
>
>
>
> "Russell Fields" wrote:
>
>> create table #x (a varbinary(8))
>> insert into #x (a) values (0x123AAA)
>> select * from #x
>> update #x set a = 0xFFF888
>> select * from #x
>>
>> drop table #x
>>
>> RLF
>>
>> "SQLFriend" <SQLFriend@discussions.microsoft.com> wrote in message
>> news:D108EF9B-1333-4A54-AD4F-CEDC68B9D819@microsoft.com...
>>
>> > Hi I have a varbinary datatype field thta I would like to update, can
>> > anyone
>> > please show me how to do it. What is the syntax that I can use to run
>> > on
>> > Query Analyzer to update the varbinary field?
>> > Thanks
>>
>>
>>


SQLFriend

3/28/2007 3:46:00 PM

0

RLF,
It turned out that Field2 stored encrypted values, so I don't think my
update statement will do it, somehow I need to encrypte it.
Thanks,

"Russell Fields" wrote:

> SQLFriend,
>
> Sure, that works fine for me on SQL Server 2000 and 2005.
>
> I would recommend more fully specifying to:
> CONVERT(varbinary(256), Field2)
>
> The NVARCHAR(50) should take a max of VARBINARY(100). However, if you
> overflow the space needed to a conversion, you will get an error message.
> Including the size in the CONVERT is a safety net.
>
> RLF
>
> "SQLFriend" <SQLFriend@discussions.microsoft.com> wrote in message
> news:901C4A49-6F15-4BCC-AC75-D97B1152A955@microsoft.com...
> > Russell,
> > Here is what I am trying to do:
> > Field1 is varbinary(256),Field2 is nvarchar(50)
> > I want to update the value of Field1 with the value of Field2
> > If I try the following code, will field2 value be saved in field1 as
> > varbinary?
> > "Update tblName SET Field1 = CONVERT(varbinary,Field2) Where
> > Field3 = 1"
> > Thanks
> >
> >
> >
> >
> > "Russell Fields" wrote:
> >
> >> create table #x (a varbinary(8))
> >> insert into #x (a) values (0x123AAA)
> >> select * from #x
> >> update #x set a = 0xFFF888
> >> select * from #x
> >>
> >> drop table #x
> >>
> >> RLF
> >>
> >> "SQLFriend" <SQLFriend@discussions.microsoft.com> wrote in message
> >> news:D108EF9B-1333-4A54-AD4F-CEDC68B9D819@microsoft.com...
> >>
> >> > Hi I have a varbinary datatype field thta I would like to update, can
> >> > anyone
> >> > please show me how to do it. What is the syntax that I can use to run
> >> > on
> >> > Query Analyzer to update the varbinary field?
> >> > Thanks
> >>
> >>
> >>
>
>
>

Anthony Allende

5/22/2009 10:28:00 PM

0


<stuthalblum@comcast.net> wrote in message
news:32183440-7113-4483-8a46-23a095acda25@b1g2000vbc.googlegroups.com...
> As someone who came of age between the end of the draft and the
> beginning of draft registration, I've always had mixed feelings about
> never having served.
>
> But I can't imagine anything I'd LESS rather do than run toward the
> people shooting at me. I'd be terrified.

I still remember being about 14 and hearing about the end of the draft. I've
never been so relieved.


Nutella

5/23/2009 1:51:00 AM

0

On May 22, 6:28 pm, "Anthony Allende" <alle...@socal.rr.com> wrote:
> <stuthalb...@comcast.net> wrote in message
>
> news:32183440-7113-4483-8a46-23a095acda25@b1g2000vbc.googlegroups.com...
>
> > As someone who came of age between the end of the draft and the
> > beginning of draft registration, I've always had mixed feelings about
> > never having served.
>
> > But I can't imagine anything I'd LESS rather do than run toward the
> > people shooting at me.  I'd be terrified.
>
> I still remember being about 14 and hearing about the end of the draft. I've
> never been so relieved.

I think someone else once agreed with you......


Galveston, oh Galveston, I still hear your sea winds blowin'
I still see her dark eyes glowin'
She was 21 when I left Galveston

Galveston, oh Galveston, I still hear your sea waves crashing
While I watch the cannons flashing
I clean my gun and dream of Galveston

I still see her standing by the water
Standing there lookin' out to sea
And is she waiting there for me?
On the beach where we used to run

Galveston, oh Galveston, I am so afraid of dying
Before I dry the tears she's crying
Before I watch your sea birds flying in the sun
At Galveston, at Galveston


ropeyarn

5/23/2009 10:56:00 AM

0

stuthalblum@comcast.net wrote:
> As someone who came of age between the end of the draft and the
> beginning of draft registration, I've always had mixed feelings about
> never having served.
>
> But I can't imagine anything I'd LESS rather do than run toward the
> people shooting at me. I'd be terrified.


Vietnam ended and the all-volunteer armed forces began while I was in
high school. I enlisted 6 months after the official end of the "Vietnam
Era", if measured it by when non-contributory GI Bill benefits of that
generation ended (Dec 31, 1976).

Doing things that put you at risk are naturally terrifying, and the
antidote is training and commitment to the people you serve with (if you
happen to be politically aligned with the policies you are have become
an instrument of, that's icing on the cake...but the amount of
reflection on this in the heat of the moment is little...there's too
much other stuff to do).

I was never asked to run towards a bullet (or away from a mortar or
artillery shell) fired in anger. Some of my service was inherently
risky. Spent some time getting launched and recovered from aircraft
carriers, a plenty dangerous vocation even without a combat environment
at your destination. Spent many hours in in unarmed, slow-moving
aircraft sharing international airspace with the armed, high-performance
aircraft of other nations who often were unhappy with our perfectly
legal presence there. Add bad weather or engines that stop working, and
the inclination is indeed to wish you were someplace else. Instead, you
focus on your training, do what your supposed to do, and hope like hell
that no matter scared they might be, that the people next to you will do
the same thing (especially the ones at the controls!). It's so much
better a response than breaking into flop sweats or soiling yourself...

Everybody wants to come home intact and alive. It doesn't always work
out that way. The week I arrived in the Philippines for the first time,
I rode past what was left of the same airframe I was supposed to fly in
that had crashed into Subic Bay a week earlier (and later I would fly
with a survivor from that plane). I arrived in Hawaii shortly after
another one crashed into a Kauai mountainside. I talked with some guys
who had been on the recovery team, and the scene was grisly. Most
military flyers can recount flights that were more eventful than we
would have liked, flights which were nearly permanently life-changing.

Sadly, some never got to enjoy the luxury of looking back on their
service with fondness (or contempt). Especially in late May, those of us
given the gift of growing old will remember those shipmates as they
were...and forever young.

God Bless all those young lives, and the families and friends deprived
of the rest of their time together.