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

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 set a field to base64 encoding

Author  Topic 

stevenandler
Starting Member

42 Posts

Posted - 2013-10-31 : 20:42:52
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.
   

- Advertisement -