?
Solved

creating new user in SQL server

Posted on 2003-03-04
5
Medium Priority
?
147 Views
Last Modified: 2010-04-04
hi

How can i create a new user in sql server than change the user to this new user so that the new database i create is owned by the new user i created.

Mahesh
0
Comment
Question by:princemahesh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 21

Expert Comment

by:ziolko
ID: 8070150
You want to do this from Delphi code? or with SQLServer's Enterprise Manager?
ziolko.
0
 
LVL 17

Accepted Solution

by:
geobul earned 150 total points
ID: 8070177
Hi,

It depends on the SQL server you are using. If you are talking about MS SQL Server, there are system stored procedures you may use: sp_addgroup, sp_adduser, sp_password. Use GRANT statement to set the necessary permissions to that user.
After adding a new user successfully you have to disconnect and connect as the newly created user. Then execute your CREATE DATABASE and CREATE TABLE statements.

You could also create the database as the first user, add a new user (using SP's above) and then execute sp_changedbowner system stored procedure at the end in order to make the newly created user the owner of that database.

Regards, Geo
0
 

Expert Comment

by:CleanupPing
ID: 9316943
princemahesh:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 

Author Comment

by:princemahesh
ID: 9319394
sorry ziolko I was away thats why i could not check the comments.....

I want to change it from delphi.....

Prince
0
 
LVL 17

Expert Comment

by:geobul
ID: 9386417
That's what I explained - from Delphi using ADOStoredProc, ADOQuery, ADOCommand components.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month12 days, 13 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question