Page 2 of 2

Posted: Thu Jan 19, 2006 7:53 pm
by rdeberry
I thought that MSSQL$SQLEXPRESS was the name of the service that it is checking for? Th first dialog has this under the service name entry which is also what I see as the service name under control panel. The default instance is SQLEXPRESS. If I name the instance, where do I enter the check for that name? In the service name text box?

So it would be MSSQL$MYINSTANCENAME under the services name?

Posted: Thu Jan 19, 2006 8:16 pm
by CandiceJones
I believe so. Just double-check the name of the SQL Express service as listed under the Control Panel -> Admin Tools -> Services applet to be sure. Note that you will need to double-click the displayed service name to obtain the actual service name in the services applet.

Posted: Thu Jan 19, 2006 9:08 pm
by Gizm0
rdeberry wrote:I thought that MSSQL$SQLEXPRESS was the name of the service that it is checking for? Th first dialog has this under the service name entry which is also what I see as the service name under control panel. The default instance is SQLEXPRESS. If I name the instance, where do I enter the check for that name? In the service name text box?

So it would be MSSQL$MYINSTANCENAME under the services name?
Yes, exactly.If your instancename is DHS then the service name will be MSSQL$DHS..So you can check for it, and take neccessary actions..Note that if you want to use SSL to connect to the SQL Server, you need special libraries installed on your pc..It doesn't make sense to use SSL when installing the database..You should remove the SSL option, and only use it afterwards, when you connect to the database from your application, just for extra protection.As long as you just want to run a script to create a database or a login, from your IA setup file, you shouldn't use SSL.

Posted: Fri Jan 20, 2006 8:18 am
by rdeberry
Thanks Gizmo. I have it installing/checking by instance name now. I am not trying to use SSL, I do not know how that option is enabled/disabled.

I have tried executing the SQL script from the installer as the sa as well as leaving the user name/password blank( I assume that mean Windows Authentication). I do not see any errors now in the log files but the script never executes.

I installed the Management Studio and logged in as sa and then executed the script manually. The script added the login correctly. I then removed the login and executed the script using Windows Authentication and it worked as well. I must be missing something simple.

Do you have an example of executing a SQL script?

Posted: Fri Jan 20, 2006 10:27 am
by Gizm0
Ok here is a sample script:

Code: Select all

~InstallAware Clipboard Data~
~MS SQL Server~
~{BC3423AE-2401-464D-A486-7E97066AA508}~
~(local),testing,test_db,sa,sesame,,"if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Kladoi]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)$NEWLINE$drop table [dbo].[Kladoi]$NEWLINE$GO$NEWLINE$",-1,0~
~mMSSQLIDE.dll\\mMSSQLExec.dll~
Also, note that, after the installation of the SQL Server, you have TO START THE SERVICE before you execute the script, as the service is NOT running, thus you may get these errors you mention..

Posted: Fri Jan 20, 2006 11:11 am
by rdeberry
Thanks Gizmo!!!!!

I had (local)\\Instancename. This was left over from when I had (local)\\SQLEXPRESS.

I have the login/createdb part working now. Now I am going to include the create tables and sprocs.

IF I load the script, it puts this "ÿþI". Is that normal?

Posted: Fri Jan 20, 2006 11:22 am
by Gizm0
rdeberry wrote:Thanks Gizmo!!!!!

I had (local)\\Instancename. This was left over from when I had (local)\\SQLEXPRESS.

I have the login/createdb part working now. Now I am going to include the create tables and sprocs.

IF I load the script, it puts this "ÿþI". Is that normal?
No i guess you're using an old version of IA or the format of the .sql file is UTF-8 and not ANSI.. it has to be ANSI to load it correctly.. if you can't load it that way, copy paste it..

Posted: Fri Jan 20, 2006 6:01 pm
by rdeberry
Can I use variables in the SQL Script?

EXEC sp_attach_db @dbname = N'DHS_MAIN', @filename1 = N'I:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\Data\\DHS_MAIN_DATA.mdf', @filename2 = N'I:\\Program Files\\Microsoft SQL Server\\MSSQL.1\\MSSQL\\Data\\DHS_MAIN_log.ldf'

I want it to be this:

EXEC sp_attach_db @dbname = N'DHS_MAIN', @filename1 = N'$PROGRAMFILES$Microsoft SQL Server\\MSSQL.1\\MSSQL\\Data\\DHS_MAIN_DATA.mdf', @filename2 = N'$PROGRAMFILES$Microsoft SQL Server\\MSSQL.1\\MSSQL\\Data\\DHS_MAIN_log.ldf'

It says it executes, but nothing happens. If I hard code it, it works from installer.

Posted: Fri Jan 20, 2006 6:25 pm
by CandiceJones
Sure, you can use variables in the SQL script freely!

Posted: Wed Feb 15, 2006 2:01 pm
by jwkerley
We have had a few problems attaching SQL databases too.

If you look in the Application event log you will see errors logged by SQL Server if the attach is being attempted but failing, which may give you some clue as to the problem.

When trying to attach with the log files, we get errors stating that the log file doesn't match the MDB.

When attaching without the log file (which would be our preferred method anyway), we have a permissions issue on one of our 2 databases we attach. The event log error from SQL stated that the MDB file didn't exist, which was clearly incorrect. Using Filemon it was apparent that the SQL service didn't have permissions to use the file, which tallies with what we see in Windows Explorer - no permissions set for it. Only confusion is that we have set permissions to Full Access for Everyone in InstallAware for the MDB, the same as the other MDB which works :roll:

Anyway, have a look in the Application event log...