Here is simple suggestion. Why not change the length of the Address  from
25 to 40 before creating the view ?
Then if you want , change it back to 25 after creating the view.
If I am wrong bear with me as it is my first post and I just got back into  
R-base after a 20 year
lull. 
Frank
 
 
In a message dated 5/29/2013 3:13:42 P.M. Pacific Daylight Time,  
[email protected] writes:

This is driving me  crazy...  Trying to create a view, here's the pared 
down  example:

CREATE VIEW vCompany (CompanyID, Address) +
AS SELECT  companyid, address FROM company WHERE type = 'A' +
UNION ALL SELECT  +
companyid, billingaddress FROM company WHERE type = 'B'

I get a  "column type mismatch in union".  The problem is that the Address 
and  the
BillingAddress are different lengths.  Address is Text 25 and  
BillingAddress is Text 40.
It refuses to put the 2 together.   

I've tried these, and still get the  mismatch:
1.    Leaving out the alias  column names and letting the view definition 
decide.
2.     Creating a new column alias name like:

CREATE VIEW vCompany (CompanyID, tmpAddress) +
AS SELECT companyid,  address FROM company WHERE type = 'A' +
UNION ALL SELECT +
companyid,  billingaddress FROM company WHERE type =  'B'

All  of it gives me a union type mismatch.  I cannot have different lengths 
 of
TEXT columns?

Anyone think of a workaround?  I'm going to be  using this in a report, and 
I suppose
I could add code to create a temp  table on the fly, but I really wanted a  
view...

Karen



Reply via email to