>I came across a situation where I created my view programmatically and it was performing just as I want. BUT whenever the "view designer" is used to modify it was screwed.
>Since I should protect usage of "view designer" for this particular views I had to find a way. Here is what I did :
>I included a dummy subquery :)
create sql view myView as ;
> select ... from table1 left join table2 on .... ;
> left join table3 on .... ;
> where .... ;
> <b>and table1.pk in (select pk from table1)</b>
This causes the designer to complain "SQL is too complex" and it doesn't open it at all. Query definition is left intact in DBC :)
>Of course for the sake of performance subquery could be made from a dummy one record table (iPK, cPK fields holding impossible values for integer and char generated PKs) :
>...where myTable.PK not in (select iPK from Dummy)
>Hope this helps to you too :)
>Cetin
I found another (and IMHO better) way of preventing the screw. Include a "FORCE" clause in your SQL (if applicable to your situation) :
create sql view myView as ;
select ... from force table1 ;
left join table2 ;
on table1.id2 = table2.id ;
left join table3 ;
on table1.id3 = table3.id ;
.... ;
inner join table5 ;
on table4.idx = lookup.id ;
order by table1.somefield
This time designer complains saying "Not a character expression" and doesn't open the view :) Yet it works as it should :)
Cetin