How to convert character type to Memo type?

I have a Memo field in SQL. I know I can convert it to character type by
CONVERT(CHAR(255), f_memo)

But I have to convert this character type back to memo type. How to do that?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Patrick MatthewsCommented:
SQL Server does not have a memo data type.  Can you clarify what you need to do here?
CastlewoodAuthor Commented:
Sorry. That is a text field, not a memo. Then, can you tell me how to convert the text type back to Character type?
Patrick MatthewsCommented:
Why not simply use CONVERT?

SELECT CONVERT(text, CONVERT(char(255), f_memo))
FROM SomeTable

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Scott PletcherSenior DBACommented:
If you want to be sure you don't truncate data, you should use "varchar(max)":
CAST(f.memo AS varchar(max))
If you don't want to use "max", you can use up to varchar(8000).
David ToddSenior Database AdministratorCommented:

In the past there were three large fields in SQL  text, ntext, and binary.

Now there is varchar( max ) and nvarchar( max ). These are meant to replace text and ntext.

I suggest that these days you should be using varchar( max ) or nvarchar( max ).

Mayank GairolaSr. Application Support Engg.Commented:
You can use either of cast or convert like below -


select CONVERT (NVARCHAR(max),f_memo) FROM table1

--Use CAST

select CAST(f_memo AS NVARCHAR(max)) FROM table1

Though I would still prefer to go with CAST unless I am converting dates or date-time values. The reason being CAST is an ANSI standard, CONVERT is not.
Scott PletcherSenior DBACommented:
text data type should be converted to varchar(max). [ntext would be converted to nvarchar(max).]
CastlewoodAuthor Commented:
If text is now Varchar(max) then the result of CONVERT(text, CONVERT(varchar(255), f_memo))
is the same as CONVERT(varchar(255), f_memo).
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.