Skip to main content

Notifications

Microsoft Dynamics RMS forum

Inserting New Customer on HQ

Posted on by Microsoft Employee

Mabuhay! Hi again! What would be the best sql query for this one;

I need to insert a new row in the table customer. If I'll use the insert into command with values it will arise an error on no null on ID. So I change my code to select max and +1 on ids but what I've got now is id+1 but I've noticed was the IDs still getting the same value like 1073905737 but different Account Number. Is there any cod ethat I forgot to write?

Code:
insert into  [DBName].[dbo].[Customer]([ID],[AccountNumber]) values((Select max (id)from [Customer]) +1, '000700005951')

Thanks,

Chris

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Inserting New Customer on HQ

    Mabuhay Sir Ed,

    Thanks for your reply and for reminding those minumum requirements on adding a row in customer table. With the IDs number do i need to manually add + or is there any code that will lookup for the updated ID and ill just add 1 on it so when i insert new one it will just follow the latest ID?

    Or is there any conflict if Ill just manually add 1 to the ID i see that time even if theres a branch is in connection and they will just auto on what i added?

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Inserting New Customer on HQ

    depends on your plans for the customer records.  

    At a minimum you need,  ID, HQID, AccountNumber, FirstName, LastName.  

    Then you need GlobalCustomer =1 if this customer will push down to stores,  The default is 0.  

    FirstName and LastName are technically optional, but then you don't know from the HQ Manager which accountnumber is whose account.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,818 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,147 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans