Customer Contact Records

SOLVED

Hello.

We need to update a number of customer records each with new contact records. 

I figure it's a simple insert query into tciContact. To get the next CntctKey number I use:

declare @contctkey int

exec spGetNextSurrogateKey 'tciContact',@cntctkey output

select @cntctkey

Does this sound right? Does anyone already have a script to help out with this? 

Thanks!

Parents
  • 0
    Most (not all) table have an import process. There is a stored procedure to import and a staging table to stage the data to be imported. For Contacts it called StgContact. I would recommend using StgContact and the import stored procedure for it. The advantage is that sot stored procedure will validate the imported records which will save some headaches down the road. DIM will work but it is a bit a pain to use.

    Pat Gough
Reply
  • 0
    Most (not all) table have an import process. There is a stored procedure to import and a staging table to stage the data to be imported. For Contacts it called StgContact. I would recommend using StgContact and the import stored procedure for it. The advantage is that sot stored procedure will validate the imported records which will save some headaches down the road. DIM will work but it is a bit a pain to use.

    Pat Gough
Children
  • 0 in reply to patgough
    i realize i need to expand upon my original request.

    the table tciContact has a number of flag fields for document transmittal... CCCreditMemo / CCCustStmnt / CCDebitMemo to name a few. these fields seem to be missing from the import processes in sage. the table stgContact doesn't have them also .
  • 0 in reply to sabian
    That is correct those fields aren't in the staging tables.

    If you decide to use an SQL INSERT, you can set CntctKey = 0 and a trigger in the tciContact table will get the next Surrogate Key for you. This only works if you INSERT one row at a time.

    Pat Gough