Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need SQL 7.0 to see database files.... 1

Status
Not open for further replies.

VictorAnderson

Programmer
May 22, 2000
15
0
0
US
Visit site
I'm a Visual FoxPro programmer, so my SQL Server knowledge is nil....<br><br>I've installed SQL Server 7.0 on an NT4 server.<br>I've moved all the &quot;data files&quot; to a directory on the same machine.<br><br>Now,...how the heck do I tell SQL Server 7.0 to startup with those datafiles?&nbsp;&nbsp;Someone somewhere else told me to try this:<br><br>EXEC sp_attach_db @dbname = N'pubs', <br> @filename1 = N'c:\mssql7\data\pubs.mdf', <br> @filename2 = N'c:\mssql7\data\pubs_log.ldf'<br><br>But...I do not see EXEC.* on the drive, so I tried the EXECSTMT command from dos, but still no luck.&nbsp;&nbsp;I assume I'm either using the wrong command or typing it in wrong or something simple and stupid like that.&nbsp;&nbsp;ANYONE got a clue here?<br><br>Thanks!<br><br>
 
Greetings from a fellow VFP'er:<br><br>You mention that &quot;I've moved all the &quot;data files&quot; to a directory on the same machine&quot;; do you mean the VFP DBF data files?&nbsp;&nbsp;Obviously, SQL Server won't operate directly on those, if that's what you intend.&nbsp;&nbsp;You'll have to use something like the DTS Import Wizard (pretty painless) to import the DBFs.<br><br>If you meant that you have SQL Server data files and want to attach them, then the statements you were given are approximately correct, but you don't run them from DOS; instead, you run them from the SQL Server Query Analyzer.<br><br>You can also use the <FONT FACE=monospace>create database...for attach</font> command, which you might find easier. <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
Ok, I think you're going to be able to help me out of this mess (thank God)<br><br>The datafiles are in SQL Server 7.0 format.&nbsp;&nbsp;This stuff is actually running on another machine 4000 miles away, I'm just trying to duplicate it for development purposes here, so I know the datafiles are ok.<br><br>You said to use the SQL Server Querry Analizer gizmo, which I have, and that the syntax for the command was basicly correct.&nbsp;&nbsp;Would you know the exact command I need to use?&nbsp;&nbsp;The datafiles are like e:\mssql7\data\autoworld2.mdf and the .ldf's are in the same spot.<br><br>Also, I notice on the other machine that there seems to be a couple of other SQL-related Services running, like sqlagent and something else.&nbsp;&nbsp;Do I need to have these going when I do this, and if so...at the risk of sounding like a bigger idiot that I already do, do you know how I can start the other services if necessary?<br><br>THANKS!!!<br> <p>Victor Anderson<br><a href=mailto:victoranderson2000@imailbox.com>victoranderson2000@imailbox.com</a><br><a href= Guru</a><br>ICQ# - 14847018
 
Try this in Query Analyzer:<br><br><FONT FACE=monospace><br>sp_attach_db 'autoworld2', <br>'e:\mssql7\data\autoworld2.mdf' </font><br><br>You may need to add the additional files separated by commas after the first file, but try it first without it. <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
Got your msg on ICQ....I belive the install of SQL Server 7.0 is bad..picking up another CD in the morning and will try it again....<br><br>Thanks!<br>-Victor <p>Victor Anderson<br><a href=mailto:victoranderson2000@imailbox.com>victoranderson2000@imailbox.com</a><br><a href= Guru</a><br>ICQ# - 14847018
 
Yep, it was the (*#@$)(@ install.&nbsp;&nbsp;It's running now.&nbsp;&nbsp;Thanks for all the help!!!!<br> <p>Victor Anderson<br><a href=mailto:victoranderson2000@imailbox.com>victoranderson2000@imailbox.com</a><br><a href= Guru</a><br>ICQ# - 14847018
 
i am trying to make a linked server with the odbc above via sql server enterprise manager. somehow i got it to work but when i try to use the query analyzer and execute my select statement (containing the 4-partname to address the table), i get an error.<br>is there a special driver that need to be installed? also, i tried to create a DTC package using this ODBC source and it worked. i don't know why i get that error on the query analyzer...
 
If I remember correctly, you must use <FONT FACE=monospace>openquery</font> to execute the statement against a linked server, such as this:<br><br><FONT FACE=monospace>select * <br>from openquery(MyLinkedServer, 'select * from linkedservertable') <br></font> <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
Hi,<br><br>I have the same problem to move the old database files to a new database.<br><br>I have a database :'database1'<br>datafiles are&nbsp;&nbsp;'database1_DATA.mdf' and 'database1_LOG.ldf'<br><br>I create a new database in another server with the same name 'database1'<br>And stop the server. Then copy the old datafiles 'database1_DATA.mdf' and 'database1_LOG.ldf' into <br>'f:\mssql7\data\' where all the sql data filed are in.<br><br>Then I start the SQL server again,<br>in Query Analyzer , I try this to execute it :<br><br>sp_attach_db 'database1_data'<br>'f:\mssql7\data\database1_data.mdf'<br><br><br>and also try this:<br>sp_attach_db 'database1'<br>'f:\mssql7\data\database1_data.mdf'<br><br><br>But it does not work, the error msg is:<br><br>Server: Msg 170, Level 15, State 1, Line 2<br>Line 2: Incorrect syntax near 'f:\mssql7\data\database1_data.mdf'.<br><br><br>Any one there can help to solve it?<br><br>Many thanks.<br><br>Xiao
 
Xiao, based on the code you entered, you need to add a comma between the arguments. <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top