Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4013430
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:22:13+00:00 2026-05-20T09:22:13+00:00

I am using SQL Server Express 2005. I have only a single database to

  • 0

I am using SQL Server Express 2005.

I have only a single database to work with & create logins, users and grant permissions on this database only.

I created a database shopDB.

Then a login shopDBLogin.

Then I selected shopDB & created a user shopDBUser for shopDBLogin. The code is:

create database shopDB

use shopDB
create login shopDBLogin with password='_'  , default_database = shopDB

use shopDB
create user shopDBUser for login shopDBLogin 

Now, i want to give permissions to shopDBUser to perform the following tasks:

–create 3 new logins L1,L2,L3 & 3 new users U1,U2,U3 inside these logins

–give permissions to U2,U3 to only insert in sql database

–create 3 application roles

How do i give permissions for these tasks to the user? Please help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:22:14+00:00Added an answer on May 20, 2026 at 9:22 am

    I’d have to go with db_securityadmin.

    Use sp_addrolemember to hand out the role.

    Example:

    EXEC sp_addrolemember 'db_securityadmin', 'shopDBUser'
    

    If you just want shopDBUser to be able to make ‘sub-users’ to his own user: You can’t do that with roles. I suggest creating a stored procedure that does this, granting the stored prcedure elevated permissions and then granting shopDBUser permissions to execute the stored procedure.

    You’ll have to make the neccesary checks in the stp yourself of course. Mostly because i THINK the concept of sub-users is simply not known in SQL.

    EDIT:
    Perhaps implement the concept of sub-users as a seperate table UserInfo. See in below example:

    CREATE PROCEDURE [dbo].[stp_CreateSubUser]
    (
        @SubUser nvarchar(200),
        @Pass nvarchar(200)
    )
    AS
    BEGIN
        EXEC('create login ' + @SubUser + ' with password=''' + @Pass + ''', default_database = shopDB')
        EXECUTE AS OWNER
        EXEC('create user ' + @SubUser + ' for login ' + @SubUser )
        EXECUTE AS OWNER
        EXEC sp_addrolemember 'db_datareader', @SubUser
        EXECUTE AS OWNER
        EXEC sp_addrolemember 'db_datawriter', @SubUser
        EXECUTE AS OWNER
    
        INSERT [dbo].[UserInfo]
        ([UserName],[ParentUserName])
        VALUES
        (@SubUser, USER)
    END
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using SQL Server 2005. I have a table with a text column
I'm using SQL Server 2005 Express, and I'm running into a strange issue. I
I'm creating an install package using InnoSetup and installing SQL Server 2005 Express. Here's
I am developing a website using SQL Server Express on my development machine. My
So, I'm using SQL Server Management Studio Express,it has been working not bad so
Using SQL Server 2005 and Management Studio how do I insert a picture into
When using SQL Server Management Studio from SQL Server 2005, I can connect to
I'm using SQL Server 2005, and I would like to know how to access
So I saw this question/comment... How to integrate SQL Server 2005 Express Edition to
While installing SQL Server 2005, I unknowingly uninstalled the existing SQL Express(I dont know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.