Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Be aware that you cannot be sure you have extracted all of a table's schema even when using both ADO (which you need for <code>CHECK</code> constraints, <code>WITH COMPRESSION</code>, etc) and ACEDAO (which you need for complex data types, etc). </p> <p>Here's an example of such a table:</p> <pre><code>Sub CantGetCheck() On Error Resume Next Kill Environ$("temp") &amp; "\DropMe.mdb" On Error GoTo 0 Dim cat Set cat = CreateObject("ADOX.Catalog") With cat .Create _ "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _ "Data Source=" &amp; _ Environ$("temp") &amp; "\DropMe.mdb" With .ActiveConnection Dim Sql As String Sql = _ "CREATE TABLE Test " &amp; _ "(" &amp; _ " data_col INTEGER NOT NULL, " &amp; _ " CONSTRAINT data_col__be_positive " &amp; _ " CHECK (data_col &gt;= 0), " &amp; _ " CONSTRAINT data_col__values " &amp; _ " CHECK ( " &amp; _ " data_col = 0 OR data_col = 1 OR data_col = 2 " &amp; _ " OR data_col = 3 OR data_col = 4 OR data_col = 5 " &amp; _ " OR data_col = 6 OR data_col = 7 OR data_col = 8 " &amp; _ " OR data_col = 9 OR data_col = 10 OR data_col = 11 " &amp; _ " OR data_col = 12 OR data_col = 13 OR data_col = 14 " &amp; _ " OR data_col = 15 OR data_col = 16 OR data_col = 17 " &amp; _ " OR data_col = 18 OR data_col = 19 OR data_col = 20 " &amp; _ " ) " &amp; _ ");" .Execute Sql Dim rs ' 5 = adSchemaCheckConstraints Set rs = .OpenSchema(5) MsgBox rs.GetString End With Set .ActiveConnection = Nothing End With End Sub </code></pre> <p>The output shows that while the definition for the constraint named <code>data_col__be_positive</code> can indeed be extracted, the <code>data_col__values</code> definition cannot (because it exceeds 255 characters).</p> <p>So really the solution is to always retain the code you used to create and subsequently alter the table. For me, using SQL DDL scripts for the purpose make a lot of sense (I do not need the few features that are not creatable via DDL).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload