How To Delete GP Company

I got allot of questions on how to delete company from GP, script below is the answer:

CAUTION: Do not delete the company from Enterprise Manager first (step 2). If this
is done, you will need to run SQL scripts to delete database tables individually. You
will need to delete any references to the company in several DYNAMICS tables. The
example below shows a list of some of the tables that might need to be removed.
Example:
Use DYNAMICS
Select * from DYNAMICS…SY01500
The result set shows you the CMPANYID and INTERID fields for your company. Run
the following script, replacing “-1″ with CMPANYID and “TWO” with INTERID with
your company’s information:
Use DYNAMICS
go
delete MC60100 where CMPANYID = -1
delete MC60200 where CMPANYID = -1
delete SY00801 where CMPANYID = -1
delete SY01500 where CMPANYID = -1
delete SY01900 where CMPANYID = -1
delete SY02000 where CMPANYID = -1
delete SY02100 where CMPANYID = -1
delete SY05200 where CMPANYID = -1
delete SY40500 where CMPANYID = -1
delete SY60100 where CMPANYID = -1
delete UPR10300 where CMPANYID = -1
delete UPR10304 where CMPANYID = -1
delete W200002 where CMPANYID = -1
delete DU000020 where companyID = -1
delete DU000030 where companyID = -1
delete DB_Upgrade where db_name = ‘TWO’

Regards,

Mohammad R. Daoud
MCP, MCBMSP, MCTS, MCBMSS
Software Development Manager
+962 – 79 – 999 65 85
Great Package For Business Solutions
daoudm@greatpbs.com
http://www.greatpbs.com/

About these ads

About Mohammad R. Daoud
Mohammad R. Daoud has been working as a Microsoft Dynamics GP consultant since 2004. His career path started with version 7.5; he studied every single tip of the application technicalities and did allot of successful implementations that includes functional consultations, analysis, and custom development projects. He holds a graduate degree in Computer Science and currently he is pursuing MBA degree in Accounting. In January 2007 he was nominated to the Microsoft Most Valuable Professional (MVP) certificate and was certified in April 2008 due to his online contributions in the Dynamics Community (Dynamics GP Newsgroups, Forums, User Groups and his blog: http://mohdaoud.blogspot.com). Worth to mention that he was also listed as one of the Microsoft Dynamics Top 100 Most Influential People in 2009 by DynamicsWorld. And more... • Demonstrated Passion for MS Products through participating in beta testing for some product versions, an effective member of Microsoft Connect. • Talented in securing strong high quality relationships with premier customers, partners and sales teams passionately and profitably. • Dedicated to meeting the expectations and requirements of internal and/or external customers • Problem Solver – Uses systematic approach to uncover true problem(s) and practical solution and can marshal resources to solve problem! • Proven record of effective account management, including Account Planning, Opportunity Management, and Business Management Excellence and working as part of a larger virtual team • Successful in delivering high quality technical engagements in the enterprise Dynamics GP implementations area according to customer requirements. • Dedicated, Committed, Self Motivated, Creative and highly focused with excellent communication, Negotiation, presentation, Active Listening and Objection Handling skills. • Experienced in Profitable researches and studies including white papers and technical presentations.

2 Responses to How To Delete GP Company

  1. Mohammad,While I like this solution because it’s simplicity, it’s not quite as portable across versions. You may want to try something a bit more generic, as follows:use DYNAMICSgo– go after CMPANYID columndeclare @table varchar(100)declare c_company cursor for select distinct rtrim(objs.name) from syscolumns cols inner join sysobjects objs on (cols.id = objs.id) inner join sysindexes indx on (cols.id = indx.id) where (cols.name = ‘CMPANYID’) and (objs.xtype = ‘U’) and (indx.rowcnt <> 0)open c_company fetch next from c_company into @tablewhile @@FETCH_STATUS = 0begin exec(‘DELETE FROM ‘ + rtrim(@table) + ‘ WHERE CMPANYID = -1′) fetch next from c_company into @tableendclose c_companydeallocate c_company– go after INTERID columndeclare c_company cursor for select distinct rtrim(objs.name) from syscolumns cols inner join sysobjects objs on (cols.id = objs.id) inner join sysindexes indx on (cols.id = indx.id) where (cols.name = ‘INTERID’) and (objs.xtype = ‘U’) and (indx.rowcnt <> 0)open c_company fetch next from c_company into @tablewhile @@FETCH_STATUS = 0begin exec(‘DELETE FROM ‘ + rtrim(@table) + ‘ WHERE INTERID = ”TWO”’) fetch next from c_company into @tableendclose c_companydeallocate c_company– go after DB_NAME columndeclare c_company cursor for select distinct rtrim(objs.name) from syscolumns cols inner join sysobjects objs on (cols.id = objs.id) inner join sysindexes indx on (cols.id = indx.id) where (cols.name = ‘DB_NAME’) and (objs.xtype = ‘U’) and (indx.rowcnt <> 0)open c_company fetch next from c_company into @tablewhile @@FETCH_STATUS = 0begin exec(‘DELETE FROM ‘ + rtrim(@table) + ‘ WHERE DB_NAME = ”TWO”’) fetch next from c_company into @tableendclose c_companydeallocate c_companyBest regards,MG.-Mariano Gomez, MVPhttp://www.maximumglobalbusiness.com

  2. Very thanks for the correction :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: