Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics RMS (Archived)

Inserting New Customer on HQ

(0) ShareShare
ReportReport
Posted on by

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
    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
    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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,865 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,723 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans