Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
gooner111
Starting Member
2 Posts |
Posted - 2008-06-03 : 22:26:19
|
| I need to setup a new database with a .mdf file. Name of the database will be “socc” and username=socc1 and password=abcdefg .Should I create a new databse with name "socc" and restore it with the .mdf file ? How do I create the required username and password ?Does the .mdf file take care of everything? |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-06-03 : 23:08:58
|
| You can't restore db from .mdf file, but can try attach it with sp_attach_single_file_db. Books online tells you how to create sql login and how to add it as db user. |
 |
|
|
gooner111
Starting Member
2 Posts |
Posted - 2008-06-03 : 23:58:04
|
| Can you please elaborate on how to attach ? I am working with SQL server for the first time, so little details would actually help more. |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-06-05 : 23:31:05
|
| Check books online for syntax and sample code. |
 |
|
|
monty
Posting Yak Master
130 Posts |
Posted - 2008-06-06 : 02:27:25
|
| sp_attach_single_file_db [ @dbname = ] 'dbname' , [ @physname = ] 'physical_name'ex: EXEC sp_detach_db @dbname = 'socc'EXEC sp_attach_single_file_db @dbname = 'socc', @physname = 'XXX:\Program Files\Microsoft SQL Server\MSSQL\Data\socc.mdf' add a login thru EM if you are on 2000 and then give pwd.. map the login to the required db and then give required permissions. let me know if it helpsits me monty |
 |
|
|
|
|
|