SQL Data Warehouse from Sage 100 2018 ProvideX tables

SOLVED

I have set up a linked server in SQL 2017 set up from Sage 100 using the v4.40.0004 ProvideX ODBC Driver.
We are looking to create a data warehouse to mirror Sage 100 ProvideX tables in full and refresh deltas throughout the day.

Pulling FULL tables dumps is straight forward. Where I am hung up on is the delta tables. Restrict by update dates, record creation date, tran date, etc. With using the linked server, I have not had the best success including a where clause in the linked server statement using the ProvideX ODBC driver.

Thank you all,

Tony Callin

TLDR: Looking for what others have done to accomplish a SQL Data Warehouse from Sage100 PX tables.

Parents
  • 0

    I've used SQL "merge" commands to update SQL data from a read-only data source.

    Try your dates in this format: {d 'yyyy-mm-dd'}

  • 0 in reply to Kevin M

    I have tried to format this a few ways. This is in SSMS as I am going to write as SP that is scheduled out.

    Without the WHERE clause, the data is returned in full. However, I need to filter to not pull 2.3 million rows of history every time.

    Here is one example:

      	SELECT	*, GETDATE() AS 'ExtractDate'
    	FROM OPENQUERY (SAGE100LS, '
    	SELECT 
    			*
    	FROM	
    			SO_SalesOrderHeader
    	WHERE
    			OrderDate = FORMAT(GetDate(), ''yyyy-MM-dd'')
    	')

    Here is the error that is returned:

    OLE DB provider "MSDASQL" for linked server "SAGE100LS" returned message "[ProvideX][ODBC Driver]Unexpected extra token: (".
    Msg 7321, Level 16, State 2, Line 1
    An error occurred while preparing the query "
        SELECT
                *
        FROM    
                SO_SalesOrderHeader
        WHERE
                OrderDate = FORMAT(GetDate(), 'yyyy-MM-dd')
        " for execution against OLE DB provider "MSDASQL" for linked server "SAGE100LS".

  • +1 in reply to ynot816
    verified answer

    {d 'yyyy-mm-dd'} not just 'yyyy-mm-dd'

  • 0 in reply to Kevin M

    Kevin,

    That returned results. Thank you!!

    My goal is perform a master data dump and do a rolling delta every few hours for updates
    If I am trying to do a GETDATE()-1, would I just declare as DATE and then call the variable in my SP?

  • 0 in reply to ynot816

    It has been a while since I set up something with a dynamic date as part of the query, but remember having to play around with a bit of T-SQL syntax to get it working... in my case I think I was using a batch parameter though instead of hard-coded logic, which might have made things harder.

Reply
  • 0 in reply to ynot816

    It has been a while since I set up something with a dynamic date as part of the query, but remember having to play around with a bit of T-SQL syntax to get it working... in my case I think I was using a batch parameter though instead of hard-coded logic, which might have made things harder.

Children