?
Solved

Casting Memo Field to VARCHAR in mSQL

Posted on 2000-02-01
4
Medium Priority
?
2,112 Views
Last Modified: 2008-02-26
I am having trouble finding a command to cast a memo field to a VARCHAR in SQL.  I want this as part of the WHERE clause.

Thanks,
Brian
0
Comment
Question by:BrianG
  • 2
  • 2
4 Comments
 
LVL 3

Expert Comment

by:gmoriak
ID: 2479582
doesn't

select convert(varchar(255), memofield)

work?
0
 

Author Comment

by:BrianG
ID: 2479840
I was sorta vague on what I was doing I guess.

I am trying to run a Seagate Crystal report and I need to get records where a memo field is equal to a certain thing, however Crystal reports does not like to have a memo field in the query.  Therefore I was trying to cast the field to a varchar.
0
 
LVL 3

Accepted Solution

by:
gmoriak earned 200 total points
ID: 2479905
Are you talking about

select blah blah
from mytable, yourtable
where convert(varchar(255), mytable.memofield) = yourtable.col

--- or ---

If Crystal is using a visual query wizard, I get around that by creating a view and using the view rather than the table in Crystal  (eg)

create view trickCrystal
as
select col1, col2, col3, convert(varchar(255), memofield) col4
from mytable

Then use trickCrystal instead of myTable as your source for Crystal reports (trickCrystal may not be the most appropriate name for your view)
0
 

Author Comment

by:BrianG
ID: 2479920
This is exactly what I was thinking.  Your first comment got me heading that way, and this second one makes me feel all warm and fuzzy.

Thanks for your help!

Brian
0

Featured Post

2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question