MS SQL script - how to check the error messsage?

Got a problem you cannot solve? Try here.
Post Reply
Bar_BQ
Posts: 99
Joined: Fri Aug 22, 2008 5:45 am

MS SQL script - how to check the error messsage?

Post by Bar_BQ »

Hi,


I'm just wondering if there is any possibility to check the error message that comes from MS SQL Server during script run. I'm trying to restore database backup file using SQL Server command:


RESTORE DATABASE [$DATABASE_RESTORE_NAME$] FROM DISK = N'$SELECTED_BAK_FILE$' WITH FILE = 1, NOUNLOAD, STATS = 10
GO

For some reason script works fine only sometimes, mostly there's an error. Does any possibility exists to check the error message?

Thanks,
BarBQ
drewau
Posts: 27
Joined: Tue Aug 05, 2008 10:29 pm
Location: Australia

Post by drewau »

I can't seem to work out how to do this either.
I can get a SUCCESS/ERROR response in "Return result in variable" variable, but I would like to get a meaningful error message from RAISERROR.

Example of one of the scripts I'm running:

Code: Select all

EXEC('IF SERVERPROPERTY(''collation'') <> ''SQL_Latin1_General_CP1_CI_AS'' 
    RAISERROR(''SQL ErrorID: 235E86A3-2DC6-4D0F-B892-CB8F8E47AE29 
    Message: Invalid SQL Collation for install'', 16, 127) with nowait')
Do I need to write a custom plug in to do this?
ulrichard
Posts: 150
Joined: Thu Dec 27, 2007 5:45 am
Location: Switzerland
Contact:

Post by ulrichard »

I would also be interested in that feature. It would make debugging a lot easier.

Rgds
Richard
http://www.pointline.com
http://www.paraeasy.ch
http://ulrichard.ch
Bar_BQ
Posts: 99
Joined: Fri Aug 22, 2008 5:45 am

Post by Bar_BQ »

Receiving only message SUCCESS or ERROR is definitely not enough. Debugging won't help that much.

I'm finding that InstallAware makes some difficult things easy, but some easy things makes difficult...
CandiceJones
Posts: 904
Joined: Thu Dec 22, 2005 7:03 pm
Contact:

Post by CandiceJones »

We'd like to add this feature. Please contact me privately if you would like to participate in testing a new version of the plugin which has this implementation in place.
Candice Jones
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Bar_BQ
Posts: 99
Joined: Fri Aug 22, 2008 5:45 am

Post by Bar_BQ »

thank you, that's very polite of you :)
Post Reply