Need Some Help Here

  • NP.  Good luck with the rest of that project.

  • Why can't you just do this:

    Declare

    @strSQL nvarchar(max)

    SELECT

    @strSQL = ' INSERT INTO EPF_PROD..tblBatch(vchBatchNo, vchRecID, vchFiller, vchStateCode, intTotalForm, intTotalEmployerCont, intTotalEmployeeCont, intHashTotal) ' +

    + ' SELECT P.vchBatchNo, P.vchRecID, P.vchFiller, P.vchStateCode, P.intTotalForm, P.intTotalEmployerCont, P.intTotalEmployeeCont, P.intHashTotal ' +

    + ' FROM ' + @tabPName + ' P with(nolock)'

    + ' Inner Join ' + @tabSName + ' S with(nolock) On P.vchBatchNo = S.vchBatchNo' +

    + ' AND P.vchRecID = S.vchRecID'

    EXECUTE

    (@strSQL)


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

Viewing 2 posts - 16 through 17 (of 17 total)

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