Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cast('' as M) and UNION problem in SQL select
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Cast('' as M) and UNION problem in SQL select
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01259819
Message ID:
01259819
Views:
69
The code below returns an error saying operation is invalid for a Memo, Blob...

It looks like I can't use cast('' as M) in a SQL select on more than one part of a UNION. If I remove the code after the union it works. As an easy fix I can remove the CAST() and do an alter table afterwards to add the memo.
Any comments?
TEXT TO mSqlCommand noshow pretext 15 TEXTMERGE
  select
  prempl.lname,
  prempl.fname,
  prempl.emplid,
  jsusers.user,
  cast(0 as  N(1,0) ) as updtflag,
  cast('' as M) as fmemo
  from <<xfjsusers>>
  join <<xfprempl>> on prempl.k_prempl = jsusers.k_prempl
  where jsusers.dbname == '<<mdbname>>'

  UNION
  select
  jsusers.lname,
  jsusers.fname,
  jsusers.emplid,
  jsusers.user,
  cast(0 as N(1,0) ) as updtflag,
  cast('' as M) as fmemo
  from <<xfjsusers>>
  where jsusers.dbname == '<<mdbname>>'
  and jsusers.k_prempl = 0

  into cursor c_jsusers readwrite
ENDTEXT
&mSqlCommand
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Next
Reply
Map
View

Click here to load this message in the networking platform