I have a local table in my database called t_CompanyData that holds a subset of the fields in another table called dbo_INT_AUX_LISTING.
dbo_INT_AUX_LISTING is a linked table via an ODBC connection. This is a table in our CRM system and the data in that table is updated constantly.
I need to run a query to:
1 - update the data in t_CompanyData with any updated data for related records in dbo_INT_AUX_LISTINGI wrote an query that updates data and adds any new records using the strategy at
2 - append any NEW records in dbo_INT_AUX_LISTING to t_CompanyData
http://support.microsoft.com/kb/127977
New records are being added to t_CompanyData. However, the value in dbo_INT_AUX_LISTING.LISTING_ID field is not being added to t_CompanyData.IA_CompanyLISTING_ID.
I have verified that the LISTING_ID field in the dbo_INT_AUX_LISTING table is a NUMBER datatype (not autonumber). It is a primary key.
Expand|Select|Wrap|Line Numbers
- UPDATE (dbo_INT_AUX_LISTING LEFT JOIN t_CompanyData
- ON dbo_INT_AUX_LISTING.LISTING_ID = t_CompanyData.IA_CompanyLISTING_ID)
- LEFT JOIN dbo_INT_AUX_DIRECTORY
- ON dbo_INT_AUX_LISTING.OWN_DIR_ID = dbo_INT_AUX_DIRECTORY.DIRECTORY_ID
- SET t_CompanyData.IA_CompanyLISTING_ID = [dbo_INT_AUX_LISTING].[Listing_ID],
- t_CompanyData.COMPANY_NM = [dbo_INT_AUX_LISTING].[Company_NM],
- t_CompanyData.DIRECTORY_NM = [dbo_INT_AUX_Directory].[directory_NM];
Sandra