Not sure why you would want to do it, but here is a way it can be done.
Only tested on MSSql server 2012 but it should work for 2008
note: text from google translate :) (correct accordingly)
declare @nvarchar nvarchar(max);
set @nvarchar = N'here is nvarchar text --- 這裡是nvarchar的文本 --- هنا هو النص nvarchar ---';
with nVarCharToImage as (
select convert(image,
convert(varbinary(max),@nvarchar)
) nVarCharImage
)
, ImageTonVarchar as(
select
convert(nvarchar(max),
convert(varbinary(max),nVarCharImage)
) ImgageTonVarChar from nVarCharToImage
)
select
(select nVarCharImage from nVarCharToImage) nVarCharImage,
(select ImgageTonVarChar from ImageTonVarchar) ImgageTonVarChar
;
If just converting varchar, you can do a direct varchar to image conversion:
declare @varchar varchar(max);
set @varchar = 'here is varchar text';
with VarCharToImage as (
select convert(image, @varchar) VarCharImage
), ImageToVarchar as(
select convert(varchar(max), convert(varbinary(max),VarCharImage)) ImgageToVarChar from VarCharToImage
)
select
(select VarCharImage from VarCharToImage) VarCharImage,
(select ImgageToVarChar from ImageToVarchar) ImgageToVarChar
;
Hope that helps you out.