sp_attach_db

sp_attach_db

Post by Maria Thomadaki » Sat, 27 Apr 2002 00:00:06



Hi,

I am trying to create a weekly job which restores two databases: one from
production to test and another test db on the same test server. To
accomplish the first task, I'm using the sp_attach_db procedure but I'm
having difficulty with an aspect of this - please see below.


from a backup the physical name obviously changes. How do I declare this as
a variable and just use the variable in the script?

Sorry for the juvenile question but I'm new to this.

Thanks,

Maria

 
 
 

sp_attach_db

Post by <msnews.microsoft.com> » Sat, 27 Apr 2002 00:40:10


Your process is uncelare to me but to answer your question, just declare a
variable and set it to the expected name and pass it into the sp as a
parameter.




convert(varchar, getdate(), 112) + '.mdf')


Keep in mind the file you attach can't be a backup file from the backup
database command.  It needs to be a valid DataBase file. . .


> Hi,

> I am trying to create a weekly job which restores two databases: one from
> production to test and another test db on the same test server. To
> accomplish the first task, I'm using the sp_attach_db procedure but I'm
> having difficulty with an aspect of this - please see below.

> exec sp_attach_db db = N'db_copy',

weekly
> from a backup the physical name obviously changes. How do I declare this
as
> a variable and just use the variable in the script?

> Sorry for the juvenile question but I'm new to this.

> Thanks,

> Maria


 
 
 

sp_attach_db

Post by Puneet Parasha » Sat, 27 Apr 2002 04:23:50


Hi,

Be careful with sp_attach_db, as it requiremetns are much higher.

The better approach is to backup the database and restore it on the
another server.

Thanks,
Puneet

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
 
 

1. sp_attach_db problem

Hi All,

I use Windows NT 4.0 and MSSQL 7.0.
I want to attach  database which database files aren't located on server
machine.
They are on remote computer. When I copy database files into the server
where MSSLQ
is instaled all is working well. But when I mapped remote hard disk to
server and try to use
sp_attach_db I've message from MSSQL Server: 'Device activation error.
The physical file name 'f:\sersys.mdf' may be incorrect.'

My question is : It is possible to attach database when database files
are on remote computer ?

Many Thanks

Sergiusz

2. XML Mapping to Database

3. SQL7 sp_attach_db problem

4. Unexpected problems with Code Revision

5. Error when using sp_attach_db

6. An Evaluation Copy of Oracle Express--

7. sp_attach_db ?

8. justifying use of surrogate key (even key of one attribute) in RDBMS

9. Restoring a database using sp_attach_db

10. Problem when i use the sp_attach_db

11. Using sp_attach_db ...

12. sp_attach_db returning this error

13. sp_attach_db