Export DDL from a Caché class
I need to generate a DDL file from a .cls class that already exists, the idea is to create a mirror table in SQL. Is it possible to do this export or do I need to do the CREATE TABLE manually?
Comments
Will an undocumented command suit you?
Yes
See the sources of method %SYSTEM.SQL:Export() for a description of the parameters.
Only instead of 0, use 1, for example:
SAMPLES><FONT COLOR="#0000ff">w $$</FONT><FONT COLOR="#ff0000">Export</FONT><FONT COLOR="#000000">^%qarDDLExport(</FONT><FONT COLOR="#008000">"Sample"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"*"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"C:\Temp\Sample.sql"</FONT><FONT COLOR="#000000">,</FONT><FONT COLOR="#008000">"WNS"</FONT><FONT COLOR="#000000">,1,0,0,0,0)</FONT>
I managed to export with the command. Thank you very much!
Here I`m, in 2025, using the same tip to solve a problem.
Thanks, Vitaliy, thanks, community.
Very useful command, thank you @Vitaliy Serdtsev
While the suggested method should still work (haven't tested), I'd advise using the official method $system.SQL.Schema.ExportDDL()
See Class Reference for documentation details and samples.
Initially, the question was asked in relation to Caché or/and Ensemble 2018.1, but not to IRIS.
Thank you @Enrico Parisi , this is helpful!