Page 1 of 1

SQL Views in 3.0

PostPosted: Fri Aug 25, 2006 8:50 pm
by sdevlin
Are views working?
So far I cannot link a form to a view. I get this everytime:

Code: Select all
Cannot work without primaryKey on table


What Am I Missing?

-sean

PostPosted: Fri Aug 25, 2006 9:13 pm
by bcusick
Ummmm... your view doesn't have a primary key included in the query. Just add a PK to the view, and it should work fine.

views not accepting a primary key

PostPosted: Mon May 07, 2007 2:10 pm
by kions
i created a view using several unions and 2 base tables but i cannot create a primary key/row identifier on any of the columns/attributes..including the columns which were primary keys in the base tables...i tried the coalese function as well as 'distinct' key word and 'is not null' ,but nothing works...my code looks like this>>>
select distinct BatchNote_Types.BNT_Code,BatchNote_Types.BNT_Description, BNT_Fields.Field_No,BNT_Fields.Field_Name,BNT_Fields.Grouping_Function,
BNT_Fields.Field_Formula,BNT_Fields.Entry_Id,BNT_Fields.Item_id,
BNT_Fields.Entry_type,BNT_Fields.Other as other1,coalesce(BatchNote_Types.BNT_Code,BNT_Fields.Field_Name) from
BatchNote_Types,BNT_Fields where
BatchNote_Types.BNT_Code = BNT_Fields.BNT_Code and BatchNote_Types.BNT_Code is not null and BNT_Fields.Field_No is not null union
select BatchNote_Types.BNT_Code,BatchNote_Types.BNT_Description,
-99999999,'Total Amount',0,'Amount','*','*','*','*','*' from
BatchNote_Types
union
select BatchNote_Types.BNT_Code,BatchNote_Types.BNT_Description,
-99999998,'No of Entries',1,'N/A','*','*','*','*','*' from
BatchNote_Types

<<<<<
where bnt_code and fied_no are primary keys on the bnt_fields table and bnt_code is the primary key of the batch_notetypes table.

PostPosted: Tue May 08, 2007 10:36 am
by rgansevles
Hi,

Servoy will only be able to work with updatable views, unions and distinct in views usually means that they are not updatable.

Rob

PostPosted: Tue May 08, 2007 2:51 pm
by srowe
I am also having an issue with using a SQL Server 2000 view to fill a value list. Is it possible to use a view in a value list. If the value list is filled from the table it works properly, but when I switch to the view the values are not filled.