General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Thanks Trey
I am a bit confused. Is it possible to have default values on views?
>You can set the v_ticket.p_ticket field's default to NextKey().
>
>>I have a table TICKET
>>It has a primary key called P_Ticket
>>
>>I have an indexed view onto this Table called V_TICKET ( CURSORSETPROP("Buffering",3) )
>>
>>To insert a record I am doing the following
>>
>>*I insert a record into v_ticket
>>
>>insert into v_ticket (ticket) values (myValue)
>>=tableupdate(.t.)
>>
>>* This triggers NextKey routine which now generates a primary key for me
>>
>>At this point I have a primary key in my TICKET table but I do not have a Primary key in my V_TICKET view table.
>>
>>Since I need this key to be in my view I populate the view primary key as follows
>>
>>REPLACE v_ticket.P_ticket WITH giPrimaryKey && giPrimaryKey gets set when nextkey() is run
>>
>>* if I now do a table update (to be on the safe side)
>>=tableupdate(.t.)
>>
>>at this point my update fails with update conflict.
>>
>>I realise that I can do a REQUERY() instead of the above REPLACE but it is very inefficient to do this at this point.
>>
>>Please advise me if there is a solution to this problem.
>>
>>(Using Tableupdate with the lForce set stops the update failing but this is not desirable)
>>
>>Many Thanks
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only