Insert SQL 2000 table into AS400 Alias

  • I am trying to insert an entire table into an AS400 Alias (membered file).  The 400 is a linked server with SQL.  I can insert 1 record at a time with this statement:

    insert openquery(AS400bck, 'select * from netfil.s2p')

    VALUES(1,6,2493,1,30,180,1,-8.00,0,-100.00,0,0,30,180,180,'',2,'X','','')

    One of the tables is quite large and I don't want to have to build the VALUES clause for it.

    How can I insert the table as a whole?

  • Depending on your OLEDB privider, try using the Four Part Naming Convention. 

    LinkedServer.RDBSName.LibraryName.FileName

    Example:

    INSERT INTO LinkedServer.RDBSName.LibraryName.FileName

    SELECT Column1, Column2, Column2, etc.

    FROM SQLTable

  • The SQL statement is

    insert openquery(AS400bck, 'select * from netfil.sp')
    select [columns] from table where xxx=yyy

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

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