Subject Re: Create views in prod fdb based on a sample fdb
Author venussoftop
Hi all

Pardon me if this is a double post. I thought I had posted this before but I don't see it on the home or messages page.

I have achieved this much (see below). Now before I execute the CREATE VIEW code I would like to confirm that all it's dependent elements (tables, fields, other views) are in place.

Please advise.

Thanks and regards.
Bhavbhuti

Please note the below are edited VFP codes to give an idea of the flow I have achieved

*** find the new Views
TEXT TO lcSQL TEXTMERGE NOSHOW PRETEXT 6
SELECT *
FROM rdb$relations
WHERE rdb$view_source IS NOT NULL
AND rdb$system_flag <> 1
ENDTEXT

*** decided to create the new view
*** find the Views fields
TEXT TO lcSQL TEXTMERGE NOSHOW PRETEXT 6
SELECT *
FROM rdb$relation_fields
WHERE rdb$relation_name = '<<ALLTRIM(curNewViews.rdb_relation_name)>>'
AND rdb$system_flag <> 1
ORDER BY rdb$field_position
ENDTEXT

_TALLY = SQLPT(lcSQL, "curNewFields", .F., pnNew)
BROWSE norm


*** find the Views fields
TEXT TO lcSQL TEXTMERGE NOSHOW PRETEXT 6
CREATE View <<ALLTRIM(curNewViews.rdb_relation_name)>>
(
ENDTEXT


SELECT curNewFields

SCAN
*** the field
TEXT TO lcSQL TEXTMERGE NOSHOW PRETEXT 6 ADDITIVE
<<ALLTRIM(curNewFields.rdb_field_name)>>
ENDTEXT

lcSQL = lcSQL + FieldDefination() + ", "


SELECT curNewFields
ENDSCAN

lcSQL = LEFT(lcSQL, LEN(lcSQL) - 2) + ")"


TEXT TO lcSQL TEXTMERGE NOSHOW PRETEXT 6 ADDITIVE
AS
<<ALLTRIM(curNewViews.rdb_view_source)>>
ENDTEXT