Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

How to write a correct query

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

How do I write a query that will auto fill the Inventory Item Account Maint. "Drop Ship Itmes" field?

 

TY

Mary

*This post is locked for comments

  • Tim Foster Profile Picture
    Tim Foster 8,515 on at
    Re: How to write a correct query

    Please tell me you're NOT doing this in a production environment.  

    Test on one item first.

    UPDATE IV00101 SET DPSHPIDX=1325 WHERE ITEMNMBR='XXXX'

    Replace XXXX with an item number.  Make sure the system replies with "(1 row(s) affected.)"

    Check to make sure it was updated.

    SELECT ITEMNMBR,DPSHPIDX WHERE ITEMNMBR='XXXX'

    Check in GP.

    If you can't get this working, please use the front-end (yes, I know it's tedious).

    Tim

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: How to write a correct query

    I just ran this:

    UPDATE IV00101 SET DPSHPIDX=1325

    It changed ALL the data in the Drop Ship row to NULL - How do I re word it to change date to 1325

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: How to write a correct query

    there is no way to change it from this query!

  • Tim Foster Profile Picture
    Tim Foster 8,515 on at
    Re: How to write a correct query

    You said, "...plug in the account number myself."  I thought you meant Dynamics GP.  SQL Server Management Studio doesn't do that.

    Tim

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: How to write a correct query

    This pulled up the info I need, BUT, it will not let me change anything !

  • Suggested answer
    Tim Foster Profile Picture
    Tim Foster 8,515 on at
    Re: How to write a correct query

    SELECT ITEMNMBR AS [Item Number],ITEMDESC AS [Item Description],

          (SELECT ISNULL([Account Number],'') FROM [Accounts]

           WHERE [Account Index]=IV00101.DPSHPIDX) AS [Drop Ship Account]

    FROM IV00101

    This will give you all Inventory Items.

    Tim

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: How to write a correct query

    I appreciate ALL your responses, but, I am leary of doing too much in SQL as I know it can be messed up easily and this method above it a bit more complicated than I want to get.

    It there a script that will pull up the inventory showing this field and I can go in an plug in the account number myself.  At least this would be easier than doing it item by item as I have over 1300 in inventory.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: How to write a correct query

    One learns something new every day!!!!

  • Tim Foster Profile Picture
    Tim Foster 8,515 on at
    Re: How to write a correct query

    The [Accounts] view in a DynamicsGP company has that already.  Script the view.  I'm trying to keep it simple.

    Tim

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    Re: How to write a correct query

    I would like to make a slight change to the sql script provided above by Tim, in order to correctly get the accounts from GP you need to actually read 2 tables, here is the script:

     Select B.Actnumst, A.Actdescr, B.Actindx from GL00105 B join GL00100 on A.Actindx = b.ActIndx where B.Actnumst = 'XXX-XXXX-XX'

      This way you will be able to read properly the accounts.

    Have a great day

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

Announcing Our 2025 Season 1 Super Users!

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

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans