Friday, March 30, 2012

How to Attach a database to SQLServer7

OK, I'm an idiot - hopefully, someone will help me out anyway...
How do I "attach" a database to SQLServer 7 ?
I created a database and developed a VB program to use it. I wanted to
demo it to a co-worker of mine. So, I COPIED the database (the .MDF
file and it associated .LDF file) (that's: copied the files with
Windows Explorer - NOT backed-them-up with Enterprise Manager) to a CD
and sent it to him (he's 2000 miles away). He copied it on to his
server (running SQLServer 7) but we can't get SQLServer to see it.
I've read a couple of things about "attaching" a copied database
(mainly Q224071) but I can't figure out how to do that. It tells me to
run a "stored procedure". How? Where is this sp_attach_db stored
procedure? And how do I use it? Can someone give me a clue as to how
to do this?
BTW, this is NOT in a production environment. No one but me uses this
database or even the server itself. So, I'm pretty much free to do
whatever needs to be done.
Thanks for any guidance.INF: Moving SQL Server Databases to a New Location with Detach/Attach
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q224071
> run a "stored procedure". How? Where is this sp_attach_db stored
> procedure? And how do I use it? Can someone give me a clue as to how
> to do this?
Well, sp_attach_db is present in the master database and this is similar to
using any conventional stored procedure. The article contains good
information on how to move a database to different locations.
HTH,
Vinod Kumar
MCSE, DBA, MCAD
www.extremeexperts.com
"Martin" <martinvalley@.comcast.net> wrote in message
news:2f7okvsjllmh0fp4nsrkp4paem59vavms4@.4ax.com...
> OK, I'm an idiot - hopefully, someone will help me out anyway...
> How do I "attach" a database to SQLServer 7 ?
> I created a database and developed a VB program to use it. I wanted to
> demo it to a co-worker of mine. So, I COPIED the database (the .MDF
> file and it associated .LDF file) (that's: copied the files with
> Windows Explorer - NOT backed-them-up with Enterprise Manager) to a CD
> and sent it to him (he's 2000 miles away). He copied it on to his
> server (running SQLServer 7) but we can't get SQLServer to see it.
> I've read a couple of things about "attaching" a copied database
> (mainly Q224071) but I can't figure out how to do that. It tells me to
> run a "stored procedure". How? Where is this sp_attach_db stored
> procedure? And how do I use it? Can someone give me a clue as to how
> to do this?
> BTW, this is NOT in a production environment. No one but me uses this
> database or even the server itself. So, I'm pretty much free to do
> whatever needs to be done.
> Thanks for any guidance.
>|||Thanks, I got it working.
What I didn't understand was HOW to execute the stored procedure. If
some other clueless newbie reads this, run "Query Analyzer" and
execute the query from there.
On Tue, 26 Aug 2003 19:59:25 -0700, Martin <martinvalley@.comcast.net>
wrote:
>OK, I'm an idiot - hopefully, someone will help me out anyway...
>How do I "attach" a database to SQLServer 7 ?
>I created a database and developed a VB program to use it. I wanted to
>demo it to a co-worker of mine. So, I COPIED the database (the .MDF
>file and it associated .LDF file) (that's: copied the files with
>Windows Explorer - NOT backed-them-up with Enterprise Manager) to a CD
>and sent it to him (he's 2000 miles away). He copied it on to his
>server (running SQLServer 7) but we can't get SQLServer to see it.
>I've read a couple of things about "attaching" a copied database
>(mainly Q224071) but I can't figure out how to do that. It tells me to
>run a "stored procedure". How? Where is this sp_attach_db stored
>procedure? And how do I use it? Can someone give me a clue as to how
>to do this?
>BTW, this is NOT in a production environment. No one but me uses this
>database or even the server itself. So, I'm pretty much free to do
>whatever needs to be done.
>Thanks for any guidance.
>|||Martin,
FYI, on SQL Server 2000 from the Enterprise Manager. Connect to the
server. Right click on Databases. Left click on All Tasks. Left click
on Attach Database... Fill in the blanks. This will not work on SQL
7.0, use the Query Analyzer. Also you do not need the ldf for an
attach, it will create a new one, although it will not hurt.
Norman
Martin <martinvalley@.comcast.net> wrote in message news:<kvfpkv4tovnk1id8td6s5i9krtlidtlscf@.4ax.com>...
> Thanks, I got it working.
> What I didn't understand was HOW to execute the stored procedure. If
> some other clueless newbie reads this, run "Query Analyzer" and
> execute the query from there.
>
> On Tue, 26 Aug 2003 19:59:25 -0700, Martin <martinvalley@.comcast.net>
> wrote:
> >OK, I'm an idiot - hopefully, someone will help me out anyway...
> >
> >How do I "attach" a database to SQLServer 7 ?
> >
> >I created a database and developed a VB program to use it. I wanted to
> >demo it to a co-worker of mine. So, I COPIED the database (the .MDF
> >file and it associated .LDF file) (that's: copied the files with
> >Windows Explorer - NOT backed-them-up with Enterprise Manager) to a CD
> >and sent it to him (he's 2000 miles away). He copied it on to his
> >server (running SQLServer 7) but we can't get SQLServer to see it.
> >
> >I've read a couple of things about "attaching" a copied database
> >(mainly Q224071) but I can't figure out how to do that. It tells me to
> >run a "stored procedure". How? Where is this sp_attach_db stored
> >procedure? And how do I use it? Can someone give me a clue as to how
> >to do this?
> >
> >BTW, this is NOT in a production environment. No one but me uses this
> >database or even the server itself. So, I'm pretty much free to do
> >whatever needs to be done.
> >
> >Thanks for any guidance.
> >

No comments:

Post a Comment