Bill Harris wrote:
>  I’m not sure what it’s doing, though; 
>  can someone give me a mental shortcut?  

It enumerates the tables in the database, I think.  I don't have much more
help for you than that, so this message is really more a primer on how I
investigate such issues, in the hope that you can use the tools to pin the
problem down further.

Looking at [1], I see the heart of  ddschtbl  is:   

    z=. sqltables sh;(<0);256;s;ns;(<0);256;t;#t  

The format of the paramters leads me to believe it's a DLL call, and indeed
from [2], it is:

    sqltables=: 'odbc32 SQLTables s x *c s *c s *c s *c s' &cd

and, yep, Microsoft's documentation of the odbc SQLTables [3] confirms the
function enumerates the tables in a database.

>  Anyone have any idea what might cause an error like this 
>  index error: ddschtbl
>  2   {“1 dat

This error means  dat  doesn't have 2 columns (i.e. it has 1 or less),
because the code is trying to pick the 2nd element from each row, and the
rows have no 2nd element.  

So maybe the tables enumeration isn't what's expected?  But  ddschtbl  does
check for errors from its function calls.  So maybe you don't have any
tables in that database?  

That is, ODBC & SQL Server don't think there's an error with the calls;
they're just returning 0 rows, but perhaps when they do so they don't
format the results the way J expects (i.e. as a table with 0 rows but the
same number of columns)?  Many environments are not as consistent as J. 
Just guessing here.

-Dan

[1]  See line 30
http://www.jsoftware.com/trac/addons/browser/trunk/data/dbman/ddx.ijs#L30
[2]  See line 25
http://www.jsoftware.com/trac/base/browser/trunk/api/odbc/api.ijs#L25
[3]  MS documentation on SQLTables
http://msdn.microsoft.com/en-us/library/ms711831(VS.85).aspx
[4]  An example use of SQLTables in VB
http://support.microsoft.com/kb/166284

PS:  All these IJS files were found by doing a Find-in-Files for the
relevant strings (ddschtbl, sqltables), and then a google search for the
resulting filename or other keywords against [site:jsoftware.com] to
locate them in the Trac repository so I could send public links to them.  

The msdn link was found by googling for [msdn odbc sqltables]. 

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to