Forum Moderators: phranque

Message Too Old, No Replies

How do I open an SQL Database file. In SQL2000

         

midi25

9:41 pm on Sep 26, 2002 (gmt 0)

10+ Year Member



Hi i have downloaded an SQL database file. And stored it on a folder on my hardrive. I want to be able to open it but for some reason SQL2k isnt in my list of programs to open it with. Is there a way to open SQL2k and then open the file.

How would you do it. Please help

Thanks

IanTurner

10:00 pm on Sep 26, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



There are numerous ways to open a SQL database file, but it depends on what type of file you have. Is it a backup, a script or a raw db file?

sun818

10:24 pm on Sep 26, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If you have SQL Server 2k installed on your server machine, you can use open Start -> Programs -> MS SQL Server -> Enterprise Manager

One of the menu options is "Import/Export". Search through the Help file for the details on importing various data types.

midi25

10:41 pm on Sep 26, 2002 (gmt 0)

10+ Year Member



its just an sql file.

the files names is joscoffee.sql

it is a database that i just want to open

IanTurner

8:36 am on Sep 27, 2002 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



A .sql file is most likely a script file and you can open it in notepad without any harmful effects.

JuDDer

8:54 am on Sep 27, 2002 (gmt 0)

10+ Year Member



it is a database that i just want to open

Just something to bear in mind:

SQL server database is a completely different animal to something like Access for example. WIth Access, you can download the database file, open it up and see the data that is being stored.

As SQL server is totally different from Access and not file based, the .sql script that you have downloaded is most likely something like a script that will create the tables on a SQL server that you have running locally, or a script that contains a query.

Dreamquick

10:44 am on Sep 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd agree with the others - by default when the query analyser saves SQL scripts it uses a .sql extension, whereas a SQL database has a .mdf extension by default.

However if it was SQL database you would need to enter attach it to a SQL server to make the most use of it, you can do this by moving the file to the machine running the SQL server, connecting to it via the query analyser and running the following stored procedure;

sp_attach_single_file_db 'DesiredDatabaseName', 'LocalPathToDatabaseFile'

This would attempt to attach the file "LocalPathToDatabaseFile" onto the SQL server with a database name of "DesiredDatabaseName", if it failed then it will give an error message explaining the problem.

- Tony