Archive: attach the db file.mdf to sql server2000


attach the db file.mdf to sql server2000
hi everyone,
i'm new in this forum and i' m lookin for a solution to my little problem
actually, i try to connect my data base to my nsis program that can be done by attaching the dbfile.mdf to sql server 2000 and dont really find a solution
i search in the forum but i dont find a good explanation
so if you can help it will be great :)
thanks


this is the right topic :)

what do you want to do exactly?
you want to connect to your DB server (ms sql server 2000) from within your installer and upload the dbfile.mdf file to it, right?

i guess, you need to send an upload command to the server, but don't ask me which one, i'm not familiar with sql server :)


I'm doing this with a VB Script file, who's attaching the database. But you need to execute your nsis installer on the SQL server.

You can also use the osql utility (inclued with sql server). I'm using this to update databases.


i have the possibility to do this with vb but i prefer find another method.
i find an example on the forum that test if the data base is connect or not but i dont understand this two command:

ReadINIStr $DBServer "$PLUGINSDIR\Database1.ini" "Field 1" "State"

ExecDos::exec "$PLUGINSDIR\osql.exe -b -S $\"$DBServer$\" -E -i $\"$PLUGINSDIR\nothing.sql$\""

and i dont know if i have to develop something like this


So, you need to use OSQL utility.

Read osql utility line command parameters.

You can write some SQL script file and execute it with osql. You must use sp_attach...

Good luck