How to serialize a record / row in SQL? Is there a way to serialize a record/row in SQL? And conversely, to deserialize something that has been serialized. 

By serialize, I mean put all of the fields in a record into one field or string.

Preferably with MySQL compatibility.

I am guessing that xml, a udf or stored procedure might be necessary.

is there a way to use xml or json directly in sql/mysql?

Thanks!
I feel my answer may lack what you are looking for but with out more context here are a couple options:


Use the mysqldump command.  

mysqldump -u user -pPassword   --no-create-db --no-create-info --where="primary_key=N"


will give you a sql insert command which you can use to reconstruct that row.  


run a query like

select * into outfile '/tmp/rowdump.data' from table where primary_key=N


This will create a file /tmp/rowdump.data in tab separated format.  This can be reimported with

load data infile '/tmp/rowdump.data' into table `table`;


If these don't suit your needs please elaborate on your use case on what you are trying to accomplish.