EXEC sp_primarykeys error message help needed

  • Hello, my first time posting and I am also fairly wet behind the ears with SQL... so hopefully I clearly explain what my issue is.

    Command I am executing:

    EXEC sp_primarykeys

    @table_server = 'my_server',

    @table_name = 'my_table',

    @table_catalog = 'my_catalog',

    @table_schema = 'my_schema';

    Error I receive:

    Msg 7399, Level 16, State 1, Procedure sp_primarykeys, Line 16

    The OLE DB provider "IBMDA400" for linked server "my_server" reported an error. One or more arguments were reported invalid by the provider.

    Msg 7311, Level 16, State 2, Procedure sp_primarykeys, Line 16

    Cannot obtain the schema rowset "DBSCHEMA_PRIMARY_KEYS" for OLE DB provider "IBMDA400" for linked server "my_server". The provider supports the interface, but returns a failure code when it is used.

    I am unsure how to interpret this error message? I am guessing it is something on the AS/400 side of things but have nothing else to figure this out by.

    I am just a user with no dba privileges. My guess is I will have to have the dba sort this out but thought I'd see if anyone in here has run across this before and could give me some intelligent pointers for my dba?

    A little more info... I am interfacing with SQL Server 2012 via SQL Server 2014 Management Studio and the table I am trying to retrieve metadata on resides on a linked server which is AS/400. I have several linked servers with tables I really know nothing about that I am expected to query so I am trying to get the metadata for them with these stored procs like sp_primarykeys, sp_tables_ex, sp_columns_ex, etc...

    Or if someone knows of a better way to obtain metadata for unknown tables on linked servers I am all ears!

    Hopefully I've provided enough details to help sort this out.

    Thank you in advance for your help!

  • Since you've had no replies so far I'll just tell you what I know. The interface you're using is the right one, and you appear to be using it correctly to access data about the linked server.

    However, access to linked servers is only ever as good as the ODBC driver used, and they are nearly always a little quirky. Getting them to work is a little tricky, and when you do you just leave them alone.

    If you just need to know the structure of I table I'd recommend just drilling down using Object Explorer in SQL Server Management Studio (see the attached image). If you can't do this then you'll need to talk to a DBA - you probably don't have the appropriate permissions.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply