delete "group"

felix.nielsen's Avatar

felix.nielsen

Oct 23, 2017 @ 11:04 AM

Hi

How do I remove/delete an non active group?

Thanks

  1. Support Staff 1 Posted by Anton Gogolev on Oct 23, 2017 @ 11:11 AM

    Anton Gogolev's Avatar

    Felix,

    Currently, there's no way to delete a Group short of deleting it directly
    from within Microsoft SQL Server Management Studio.

  2. 2 Posted by felix.nielsen on Oct 23, 2017 @ 11:16 AM

    felix.nielsen's Avatar

    Ok :( - can you send med a TSQL to remove the group? - I guess the table "group" is not enough? - there is no permissions or projects assigned

    Felix

  3. Support Staff 3 Posted by Anton Gogolev on Oct 23, 2017 @ 11:29 AM

    Anton Gogolev's Avatar

    Felix,

    It goes as follows:

    begin tran
    delete from [Group] where Name = 'YOUR-GROUP-NAME-HERE'
    rollback tran

    You can double-check that everything is fine and then replace "rollback"
    with "commit" and re-run the script.

  4. 4 Posted by felix.nielsen on Oct 23, 2017 @ 11:35 AM

    felix.nielsen's Avatar

    ok thanks - but I see there is a reference in GroupPermissionJunction also?

  5. Support Staff 5 Posted by Anton Gogolev on Oct 23, 2017 @ 11:57 AM

    Anton Gogolev's Avatar

    Felix,

    There could very well be. In this case,

    declare @name nvarchar(200) = 'YOUR-GROUP-NAME-HERE'

    begin tran
    delete g from [Group] g inner join GroupPermissionJunction gpj on
    gpj.GroupID = g.ID and g.Name = @name
    delete from [Group] where Name = @name
    rollback tran

  6. 6 Posted by felix.nielsen on Oct 23, 2017 @ 12:04 PM

    felix.nielsen's Avatar

    thx will try it

Reply to this discussion

Internal reply

        No formatting (switch to Markdown)

          You can attach files up to 10MB

          If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

            Keyboard shortcuts

            Generic

            ? Show this help
            ESC Blurs the current field

            Comment Form

            r Focus the comment reply box
            ^ + ↩ Submit the comment

            You can use Command ⌘ instead of Control ^ on Mac