all groups > sql server msde > october 2005 >
You're in the

sql server msde

group:

Attaching a Database


Attaching a Database nbohana
10/31/2005 7:14:03 PM
sql server msde:
I need some help, I am new at MSDE. I know the command to use but I am not
so sure how to use it. I tried to 'EXEC sp_attach_db @dbname = kennel' at
the command prompt. Can someone point me in the right direction please.
--
Re: Attaching a Database nbohana
11/1/2005 10:57:06 AM
Thank you, can I issue this command at the command line? I tried and windows
could not find the 'EXEC' command? Please advise. Again thank you.
--
Norm Bohana


[quoted text, click to view]
Re: Attaching a Database Andrea Montanari
11/1/2005 12:54:37 PM
hi,
[quoted text, click to view]

you have to provide the full command in the correct syntax , that's to say
EXEC sp_attach_db @dbname = N'pubs',
@filename1 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\pubs.mdf',
@filename2 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\pubs_log.ldf'

specifying all files part of the database it self..
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_sp_ae-az_52oy.asp

--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org
DbaMgr2k ver 0.15.0 - DbaMgr ver 0.60.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply

Re: Attaching a Database Andrea Montanari
11/2/2005 12:00:00 AM
hi,
[quoted text, click to view]

the statement you have to execute is not a DOC command, sorry... you have to
execute it via a tool enabled to connect to and perform such tasks to SQL
Server/MSDE...
MSDE provides a command line tool, oSql.exe, you can use..
please have a look at
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q325003 for some
basic info about oSql.exe....
when you are logged in you will be prompted with a prompt like
1>

just type the statement and at very last type GO (and hit return key) so
that you have something like

1>EXEC sp_attach_db @dbname = N'pubs',
2>@filename1 = N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\pubs.mdf',
3>@filename2 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\pubs_log.ldf'
4>GO

and the command will be executed...
further info about oSql and it's synopsis can be found at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/coprompt/cp_osql_1wxl.asp

--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org
DbaMgr2k ver 0.15.0 - DbaMgr ver 0.60.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply

AddThis Social Bookmark Button