Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 set a field to base64 encoding
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

stevenandler
Starting Member

USA
42 Posts

Posted - 10/31/2013 :  20:42:52  Show Profile  Reply with Quote
I am trying to write a t-sql script that will take the data in a field called USER_ID and retrieve the Base64 value and place it in a field called USER_DEFINED_01. Here's the statement:

UPDATE OGEN.GEN_M_USER SET USER_DEFINED_01 =
SELECT
CAST(N'' AS XML).value(
'xs:base64Binary(xs:hexBinary(sql:column("bin")))'
, 'VARCHAR(MAX)'
) Base64Encoding
FROM (
SELECT CAST(USER_DEFINED AS VARBINARY(MAX)) AS bin
) AS bin_sql_server_temp;


I get the following response message:

Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'SELECT'.




The statement works fine if I don't include the update but the whole point of this project is to generate a base64 code and place it in the field.

Thank you for your help.
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000