MS SQL Plugin -> get result of select to variable

Got a problem you cannot solve? Try here.
StyX
Posts: 51
Joined: Fri Apr 11, 2008 7:14 am
Location: Stavanger, Norway
Contact:

MS SQL Plugin -> get result of select to variable

Postby StyX » Fri Feb 06, 2009 9:13 am

So I'm running a select query where I get a folder path back (like c:\\temp) and I want to store this in a variable. Now when I use the return variable provided by the plugin I simply get Success back into the variable.

It might be me having a real brain freeze here. But anyone out there that has a suggestion ?

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

Postby MichaelNesmith » Fri Feb 06, 2009 11:41 am

Sorry, we don't have the ability to return that right now. We are currently testing a new version of the plug-in with some volunteers that returns detailed error messages. However, a return value from a script is currently not supported.

If you would like to participate in the current set, and offer us help in also returning an error result from the script execution, please contact me privately.
Michael Nesmith
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

Marko
Posts: 25
Joined: Tue Feb 08, 2011 2:18 am

Re: MS SQL Plugin -> get result of select to variable

Postby Marko » Tue Mar 01, 2011 3:51 am

Hi Mihael

Is there anything new?
I am very interesting in getting result from sql scripts.
I am currently using version 10.10 and still getting SUCCES as a result.


Regards
Marko

giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: MS SQL Plugin -> get result of select to variable

Postby giaviv » Tue Mar 01, 2011 12:06 pm

Dear Marko,

I am afraid that we are still unable to return results from SQL scripts. Please consider other alternatives such as writing to a file and then reading from it.
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Marko
Posts: 25
Joined: Tue Feb 08, 2011 2:18 am

Re: MS SQL Plugin -> get result of select to variable

Postby Marko » Wed Mar 02, 2011 2:49 pm

Hi Aviv

I am already using this alternatives but sometimes is a little hard to get results.
I hope you will come up with some solution.


Best whishes
Marko

Marko
Posts: 25
Joined: Tue Feb 08, 2011 2:18 am

Re: MS SQL Plugin -> get result of select to variable

Postby Marko » Wed Jul 20, 2011 7:20 am

Hi Aviv

I came up with solution to get result from Oracle script.
It is not perfect and may not be suitable for all situations.

It is based on the fact that executing the script returns result in variable which returns the status of the script (SUCCESS, some error, ...).
Well, if there is an error then this variable returns complete contents of that error. So there is a statement in Oracle to produce such an error:
raise_application_error(err_num, err_txt);
Based on this I created script (see example):

declare
rez string(10);
begin
select count(*) REZULTAT into rez from user_tab_columns
where table_name = 'BP3EXCG' and column_name = 'TIPUVOZ';
raise_application_error(-20000, rez);
end;

First you define (declare) an variable to store result of the script.
Then modify the script by inserting - "into rez".
Finally insert raise_application_error statement.
Then on Oracle Database Script DialogBox select "Abort execution on script error".

When script is executed an error will raise and variable of Oracle Database Script will get the content of this error:
ORA-20000: "content of rez" ORA-XXXXX $NEWLINE$ "ERROR message"


I hope this will help someone.


Regards
Marko

giaviv
Posts: 2039
Joined: Fri Dec 17, 2010 1:39 pm

Re: MS SQL Plugin -> get result of select to variable

Postby giaviv » Wed Jul 20, 2011 2:42 pm

Thanks for sharing!
Aviv Giladi
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

mikKummerfeld
Posts: 252
Joined: Sat Dec 03, 2011 3:07 am
Location: Konstanz, Germany
Contact:

Re: MS SQL Plugin -> get result of select to variable

Postby mikKummerfeld » Tue Jan 15, 2013 6:24 am

still not possible? I have a select statement but I need the result of that...like into a table in my setup
Kind regards

Heiko Kummerfeld
MIK GmbH

Setup developer for .NET BI Software (12 products)
Head of quality assurance
technical consultant

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: MS SQL Plugin -> get result of select to variable

Postby FrancescoT » Tue Jan 15, 2013 11:07 am

Dear Mik,

Unfortunately, it is not possible.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

mikKummerfeld
Posts: 252
Joined: Sat Dec 03, 2011 3:07 am
Location: Konstanz, Germany
Contact:

Re: MS SQL Plugin -> get result of select to variable

Postby mikKummerfeld » Tue Jan 15, 2013 11:36 am

So I can only create a sql statement to create a table on the sql server (so push something, but not get results)?
Do you have a workaround for that problem ???

----> Point for InstallShield right? :D
Kind regards

Heiko Kummerfeld
MIK GmbH

Setup developer for .NET BI Software (12 products)
Head of quality assurance
technical consultant

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: MS SQL Plugin -> get result of select to variable

Postby FrancescoT » Tue Jan 15, 2013 11:46 am

Dear Mik,

Honestly, I really don't if it is possible with that "other" tool you mentioned :roll: .

Anyway, if I'm not wrong, you should use a stored procedure in order to have a result.
You could try to run a call to SQLEXEC using Run Program command and then checking the result value ... probably it works.
I used SQLEXEC to run script in the past, but I never tried with a stored procedure.

Let me know.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

mikKummerfeld
Posts: 252
Joined: Sat Dec 03, 2011 3:07 am
Location: Konstanz, Germany
Contact:

Re: MS SQL Plugin -> get result of select to variable

Postby mikKummerfeld » Fri Jan 18, 2013 1:44 am

We use now sqlcmd from sql native client and write that into a textfile and then we read it...now it works :)
Kind regards

Heiko Kummerfeld
MIK GmbH

Setup developer for .NET BI Software (12 products)
Head of quality assurance
technical consultant

FrancescoT
Site Admin
Posts: 5360
Joined: Sun Aug 22, 2010 4:28 am

Re: MS SQL Plugin -> get result of select to variable

Postby FrancescoT » Fri Jan 18, 2013 9:07 am

Happy you solved :D !
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

christ23
Posts: 82
Joined: Mon Jan 16, 2012 4:51 am

Re: MS SQL Plugin -> get result of select to variable

Postby christ23 » Mon Jan 21, 2013 12:16 pm

Hi Mik (and all the others),

if you only get ONE parameter back (sounds like this as you are saying you want to have "C:\.....") - maybe then i got a solution for you. Or the first steps for a solution ;).

I have written a C# plugin, which allows you to get back ONE value (we only need to get something back from "select count(*) from...."). If you want, i can send you the source code of my plugin. (It is written for oracle, but the logic will be still the same on nearly every other DB type).

Just give post and i will send it to you.

mikKummerfeld
Posts: 252
Joined: Sat Dec 03, 2011 3:07 am
Location: Konstanz, Germany
Contact:

Re: MS SQL Plugin -> get result of select to variable

Postby mikKummerfeld » Mon Jan 21, 2013 12:24 pm

I need more than 50 results from one query, sometimes about 6000 :) But it is solved very good now.
Thank you :)
Kind regards

Heiko Kummerfeld
MIK GmbH

Setup developer for .NET BI Software (12 products)
Head of quality assurance
technical consultant


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 49 guests