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

I have achieved this much (see below). Now I would like to know if there are any dependencies that are missing before I run the CREATE VIEW code.

Please advise.

Thanks and regards
Bhavbhuti

Please note the following are direct paste of edited the VFP code just 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


*** 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)


*** 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