Openrowset

  • I am using an openrowset function to get values from a server as

    SELECT a.*

    FROM OPENROWSET('SQLOLEDB','myserver';'sa';'MyPass',

       'SELECT * FROM pubs.dbo.authors ORDER BY au_lname, au_fname') AS a

    GO

    whatvere gets returned from here can this be stored into a variable. Anyone ha a better idea about this?

    Thanks

     

  • Have you tried doing an INSERT INTO #Table with the same schema as your openrecordset?

    INSERT INTO #Table (field1, field2, field3)

    SELECT a.field1, field2, field3

    FROM OPENROWSET('SQLOLEDB','myserver';'sa';'MyPass',

       'SELECT field1, field2, field3 FROM pubs.dbo.authors ORDER BY au_lname, au_fname') AS a



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Or try table variable

    DECLARE @tblvar(...)

    INSERT INTO @tblvar

    SELECT ....


    Kindest Regards,

    Vasc

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

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