SQL Server return values

Got a problem you cannot solve? Try here.
manso
Posts: 15
Joined: Wed Aug 23, 2006 9:47 am

SQL Server return values

Postby manso » Wed Aug 23, 2006 9:54 am

Hi,

I'm struggling with SQL Server script deployment. I'd like to be able to execute an SQL statement and feed the return value to a variable. More specifically, our app only works on 2005 and we would like to verify the version of SQL Server you are connecting to. We have other things we would like to do such as verify access rights before deploying script.

Can you point me in the right direction?

Thanks,
Manso

MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Postby MichaelNesmith » Wed Aug 23, 2006 1:23 pm

I think you can take care of these inside your SQL script.
The Check Service command and Read Registry commands may also be used to check for a particular version and instance of SQL Server.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

manso
Posts: 15
Joined: Wed Aug 23, 2006 9:47 am

Postby manso » Wed Aug 23, 2006 1:33 pm

Hi,

Thanks for your reply.

>> I think you can take care of these inside your SQL script.

I certainly can but there's no way I can communicate back what went wrong. All I get is ERROR.

>> The Check Service command and Read Registry commands may also
>> be used to check for a particular version and instance of SQL Server.

The SQL Server is not typically available on the same machine so this is not an option. This must be an issue for anyone targeting a specific db version, no?

I ended up writing a console application that takes care of the SQL struff. Simply SUCCESS/ERROR is not sufficient to build a solid db initialization imho. I now have a problem communicating back detailed error messages from the console application because I only have exit codes to work with but at least I can execute it multple times asking for version, create db, apply schema etc etc.

Regards,
Manso

Gizm0
Posts: 339
Joined: Wed Nov 09, 2005 8:47 pm

Postby Gizm0 » Wed Aug 23, 2006 2:01 pm

Instead of creating an console application, you can simply make your script echo the return codes/text/error message to a text file (within the SQL Script), and read it through the Read Text from File command of InstallAWARE.Of course what you read, you can put it on a variable.

I think it's far more easier that way..
Panagiotis Kefalidis
Software Design Team Lead
\"In order to succeed, your desire for success should be greater than your fear of failure\"
InstallAware Software Corporation

manso
Posts: 15
Joined: Wed Aug 23, 2006 9:47 am

Postby manso » Wed Aug 23, 2006 2:12 pm

How can I echo messages from SQLServer if the db instance is located on a locked down server somewhere? The installation is typically not being run on the db server. I can't find a way to get the result from SQLServer stored somewhere.

Thanks,
Manso


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 179 guests