holemania
asked on
SQL - Create Database as a specific user
How would I set it so that when I create a database, that a specific user have permission to it. When I create the database file mdf and ldf, it set a user "SYSTEM" as the only one having access. Once I go and add myself, I can then copy, move, or delete the file. I don't want to have to do that everytime I create a database. Is there a way to set it up so that I have access to the MDF and LDF file?
why do you need to copy those files ? the way to do this is to start the sql server service under your windows credentials
ASKER
I had set an automate archiving where it takes the file and zip, then move it to another location. Since it is created under "SYSTEM", it won't let me do that until I add myself as a user. I even tried logging in as myself and do this, no luck. Kept giving "SYSTEM" as the default and only user.
>I had set an automate archiving where it takes the file and zip, then move it to another location
Why dont you backup the database and copy it instead of doing this.
Why dont you backup the database and copy it instead of doing this.
ASKER
Sorry I didn't specify, but I am dumping specific tables for this dump database. So I set a script to create the database, insert tables into this database, detach. Once that's done, I create a batch script that goes and zip the MDF and LDF file, then FTP it out to someone.
Since the MDF and LDF has user 'SYSTEM', it won't let me zip the database files. So I would have to do that part manually, by adding myself. Once done, then I can zip and ftp it out.
Since the MDF and LDF has user 'SYSTEM', it won't let me zip the database files. So I would have to do that part manually, by adding myself. Once done, then I can zip and ftp it out.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks. By setting a domain user and startup the service with that account did it.