Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

New sql view

(0) ShareShare
ReportReport
Posted on by 5

Hi,

I need to create new view in SQL which will show me all vendors with their active account number. Can you help me ?

  • Martin Dráb Profile Picture
    232,982 Most Valuable Professional on at
    RE: New sql view

    Regarding active bank accounts, I think that you should check ActiveDate and ExpiryDate fields.

  • Martin Dráb Profile Picture
    232,982 Most Valuable Professional on at
    RE: New sql view

    Hmm, I thought you want to create a view in AX 2012. If so, you should create it in AOT. Meddling with the database directly is difficult and risky. You would need direct access to the database, you would bypass AX security, you couldn't use AX business logic (which is likely your current problem), you would have to manually handle data areas (which is where you've failed already), date-effective tables (another bug) and so on and so on. Please stop that and create a view in AOT.

    By the way, please always paste formatted code via Insert > Insert Code (in the rich-formatting view). For example:

    SELECT DISTINCT * FROM VendTable
    LEFT OUTER JOIN VendBankAccount ON VendBankAccount.VendAccount = VendTable.AccountNum
    --AND  VendBankAccount.AccountId = VendTable.BankAccount
    LEFT OUTER JOIN DirPartyTable ON DirPartyTable.RECID = VendTable.Party
    LEFT OUTER JOIN LogisticsPostalAddress AS Address ON Address.Location = DirPartyTable.PrimaryAddressLocation

    That's much easier to read, isn't it?

  • mwit Profile Picture
    5 on at
    RE: New sql view

    I'm not sure how to filter only active accounts numbers

    I try something like this:

    SELECT distinct VENDTABLE.ACCOUNTNUM, DIRPARTYTABLE.NAME,Address.ADDRESS ,

    VendBankAccount.ACCOUNTID BankAccount ,VendBankAccount.NAME 'Bank Name' ,VendBankAccount.ACCOUNTNUM 'Bank account number',

    VendBankAccount.RegistrationNum 'Routing Number',VendBankAccount.SWIFTNo,VendBankAccount.BankIBAN

    from VENDTABLE left outer JOIN VendBankAccount ON VendBankAccount.VENDACCOUNT = VENDTABLE.ACCOUNTNUM --AND  VendBankAccount.ACCOUNTID = VENDTABLE.BANKACCOUNT

    left outer join DIRPARTYTABLE ON DIRPARTYTABLE.RECID = VENDTABLE.PARTY

    left outer join LOGISTICSPOSTALADDRESS AS Address ON Address.LOCATION = DIRPARTYTABLE.PRIMARYADDRESSLOCATION

  • Martin Dráb Profile Picture
    232,982 Most Valuable Professional on at
    RE: New sql view

    Okay, and what's the problem?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,241 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,982 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans