SQL Server Forums
Profile | Register | 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
 New Topic  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  
 New 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.03 seconds. Powered By: Snitz Forums 2000