Home » Listing Details
Top Websites
  1. Dynamics GP Help
    Over 6400 resources listed.
  2. Mark Polino's DynamicAccounting.net
    Over 5100 resources listed.
  3. Rose Business Solutions Blog New
    Over 2200 resources listed.
  4. Developing for Dynamics GP - By David Musgrave and the MS GP Dev Support Team
    Over 1100 resources listed.
  5. Mariano Gomez at The Dynamics GP Blogster
    Over 1000 resources listed.
  6. Microsoft Dynamics Partner Community Blog
    Over 900 resources listed.
  7. Christina Phillips, Steve Endow & Lorren Zemke at Dynamics GP Land
    Over 700 resources listed.
  8. Mohammad Daoud's Dynamics GP Blog
    Over 600 resources listed.
  9. Vaidy Mohan at Dynamics GP - Learn & Discuss
    Over 500 resources listed.
  10. Inside Microsoft Dynamics GP Official Blog
    Over 500 resources listed.
  11. eOne Business Solutions Blog
    Over 400 resources listed.
  12. About Dynamics, Development and Life
    Over 300 resources listed.
  13. Frank Hamelly at GP2theMax
    Over 300 resources listed.
  14. Dynamics CPM
    Over 300 resources listed.
  15. BKD Dynamics GP Insights Blog
    Over 200 resources listed.
  16. Leslie Vail at Dynamics Confessor Blogspot
    Over 200 resources listed.
  17. Victoria Yudin's Dynamics GP Website
    Over 200 resources listed.
    Victoria Yudin
  18. Janakiram M.P. at DynamicsBlogger
    Over 100 resources listed.
  19. VS Tools Forum
    Over 100 resources listed.
    Your Resource for Visual Studio Tools for Dynamics GP
  20. Inside Microsoft Dynamics GP Official Blog
    Over 100 resources listed.
  21. US Dynamics GP Field Team Blog
    Over 100 resources listed.
  22. Catherine Eibner MBS Developer Evangelist
    Over 100 resources listed.
  23. Sivakumar Venkataraman at Interesting Findings & Knowledge Sharing
    Over 100 resources listed.
  24. Dynamics Small Business
    Over 100 resources listed.
  25. Belinda, The GP CSI
    Over 100 resources listed.

ID:12662
Title:SQL Script to provide access to Transaction Dimension Codes to Users
URL:http://cvakumar.com/msdynamics/2010/05/11/sql-script-to-provide-access-to-transaction-dimension-codes-to-users/
Description:

Hi all

I had posted an article sometime back titled Macro to provide access to Transaction Dimension Codes to Users where I had provided a SQL script to create a macro code to provide access to all users to all transaction dimension codes setup in the company.

I had received a few comments from user community if the same task which is done by macro can be done using a SQL script. So I decided to write up a simple script to provide access to all users to all transaction dimensions and dimension codes setup in a company.

DECLARE @INTERID CHAR(5)
DECLARE @CMPANYID INT
DECLARE @CMPNYNAM CHAR(30)

DECLARE crCompanies CURSOR
    FOR SELECT  INTERID
        FROM    DYNAMICS..SY01500
        ORDER BY INTERID

OPEN crCompanies

FETCH NEXT FROM crCompanies INTO @INTERID

WHILE @@fetch_status = 0
    BEGIN
        PRINT '/* Updating AA Code Access in the database ' + RTRIM(@INTERID)
            + ' */'
        PRINT 'DELETE FROM ' + RTRIM(@INTERID) + '..AAG02000 '
        PRINT 'INSERT INTO ' + RTRIM(@INTERID)
            + '.dbo.AAG02000 (USERID, aaTrxDimID, aaTrxDimCodeID, aaDistribute, aaAdjust)
	(SELECT B.USERID, A.aaTrxDimID, A.aaTrxDimCodeID, 1, 1 FROM '
            + RTRIM(@INTERID)
            + '..AAG00401 A CROSS JOIN DYNAMICS..SY01400 B) '

        FETCH NEXT FROM crCompanies INTO @INTERID
    END

CLOSE crCompanies

DEALLOCATE crCompanies

Note that this script will delete any access records in the table and re-define access to all the users in that company to all the transaction dimension and codes.

This script is free for use and does not cover any warranties. As always, please have a backup of your DYNAMICS and company databases before you execute this script. Also make sure all users have logged out of GP to ensure no data discrepancy occurs. :)

Hope this script helps you all… Until next post…

Category:SQL SCRIPTS: Analytical Accounting (SQL)
Link Owner:
Date Added:June 21, 2010 04:09:34 PM
Number Hits:178
RatingsAverage rating: (0 votes)
Reviews

No Reviews Yet.