Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL forum
Answered

Deleting a Company Completely from SL

Posted on by 2,389

Does anyone know of a good tool (or back-end scripts) on how to delete a company completely from the SL system?

  • SU-22040800-0 Profile Picture
    SU-22040800-0 2,389 on at
    RE: Deleting a Company Completely from SL

    Thanks Elaine

    I am communicating with the customer as well, and will possibly log a direct call with Microsoft surrounding this. (just so its official)

    Thanks a mil!

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Deleting a Company Completely from SL

    The only idea I would have is to share the tables that contain the cpnyid field and then remove one by one from each of the tables where cpnyid = 'xxxx'

    SET QUOTED_IDENTIFIER OFF

    GO

    DECLARE @tablename varchar(30)

    DECLARE tables_cursor CURSOR

      FOR

    select name from sysobjects where xtype = 'U' and id in (select id from syscolumns where name = 'Cpnyid')

    order by name

    OPEN tables_cursor

    FETCH NEXT FROM tables_cursor INTO @tablename

    WHILE @@FETCH_STATUS = 0

    BEGIN

    PRINT  @tablename

    FETCH NEXT FROM tables_cursor INTO @tablename

    END

    CLOSE tables_cursor

    DEALLOCATE tables_cursor

    SET QUOTED_IDENTIFIER ON

    GO

    Here is a script to find all of the tables that contain a particular field name like Cpnyid

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,989 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,588 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans