Sql/osql help
-
ok i work for a company and we use msde for our software that we distribute. This means we need to run creation scripts on every new customer. I know there is a tool called osql. we have the msde database using windows auth. where i run into a problem is when i put this on someones machine and try to run osql it asks me for a password. it does not ask for a user name and you can't type anything in for the password so i hit enter and then it tells me that it is invalid so how do i go about fixing this problem?
-
ok i work for a company and we use msde for our software that we distribute. This means we need to run creation scripts on every new customer. I know there is a tool called osql. we have the msde database using windows auth. where i run into a problem is when i put this on someones machine and try to run osql it asks me for a password. it does not ask for a user name and you can't type anything in for the password so i hit enter and then it tells me that it is invalid so how do i go about fixing this problem?
Why do things the hard way? Why not just create a database with an empty structure, do a sp_detachdb and ship the MDF file as part of your install... Then, write a program that does a sp_attachsinglefiledb and your DONE. onwards and upwards...
-
Why do things the hard way? Why not just create a database with an empty structure, do a sp_detachdb and ship the MDF file as part of your install... Then, write a program that does a sp_attachsinglefiledb and your DONE. onwards and upwards...
-
i have tried that but cant quite get the syntax right could you provide a little more help and by the way thanks
I assume that you looked up sp_detach_db in the Books Online, so.... Assuming your db name is MyDB: exec sp_detach_db 'MyDB' then, simply include the MyDB.mdf file on your install and copy it to your install dir (assumes c:\MyApp\Data) after the install, call a program that connects to MSDE and issues the following command: exec sp_attach_single_file_db 'MyDB', 'c:\MyApp\Data\MyDB.mdf' then you are DONE. Just make sure that MSDE is installed with the same charset and sort order as you are using in-house. onwards and upwards...
-
I assume that you looked up sp_detach_db in the Books Online, so.... Assuming your db name is MyDB: exec sp_detach_db 'MyDB' then, simply include the MyDB.mdf file on your install and copy it to your install dir (assumes c:\MyApp\Data) after the install, call a program that connects to MSDE and issues the following command: exec sp_attach_single_file_db 'MyDB', 'c:\MyApp\Data\MyDB.mdf' then you are DONE. Just make sure that MSDE is installed with the same charset and sort order as you are using in-house. onwards and upwards...
-
ok i work for a company and we use msde for our software that we distribute. This means we need to run creation scripts on every new customer. I know there is a tool called osql. we have the msde database using windows auth. where i run into a problem is when i put this on someones machine and try to run osql it asks me for a password. it does not ask for a user name and you can't type anything in for the password so i hit enter and then it tells me that it is invalid so how do i go about fixing this problem?
Look at the help:
osql -?
Examples:osql -S_myserver_ -U_myusername_ -P_mypassword_
for supplying username and password orosql -E
to use a trusted connection. Then you can also specify the scriptfile to be executed by adding the-i_scriptfile_
parameter. These options are case-sensitive.