Execute SQl Query with a SQL data coumm data length [nvarchar](MAX) cause "allocation" error.

Having trouble running Advanced Installer? Got a bug to report? Post it all here.
agvinh
Posts: 3
Joined: Thu May 26, 2016 8:44 am

Execute SQl Query with a SQL data coumm data length [nvarchar](MAX) cause "allocation" error.

Postby agvinh » Thu Nov 23, 2017 1:21 pm

Hi,

I meet a problem when execute custom SQL query action to get a field from SQL Server database's column with the data type "[nvarchar] (MAX)"

CREATE TABLE [tbl_Config](
[Variable] [nvarchar](50) NOT NULL,

[Value] [nvarchar](MAX) NULL,
[Description] [nvarchar](150) NULL,
[Created] [smalldatetime] NULL DEFAULT (getdate()),
[SoftwareGroup] [varchar](50) NULL
) ON [PRIMARY]


The following sql is OK: SELECT [Description] FROM [tbl_Config] WHERE [Description] = '\\IP_ADRESS\'
But executing this sql is failed: SELECT [tbl_Config].[Value] FROM [tbl_Config] WHERE [tbl_Config].[Variable] = 'Val1'

The errors in log:
OnSqlFetch: bad allocation
OnSqlFetch: SQL script: [SqlQueryDatabaseSize] FAILED !
OnSqlFetch: Aborting install...
.
.
.

CustomAction SqlQueryActionDatabaseSize returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 18:51:22: SqlQueryActionDatabaseSize. Return value 3.


Please help me with the above error.

Attached is the Advanced installer project and log file.

I am using Advanced installer version 14.4.2

With best regards,
Vinh Nguyen
Attachments
SQLSample.aip
(44.52 KiB) Downloaded 2 times
logB637.log
(117.43 KiB) Downloaded 2 times

agvinh
Posts: 3
Joined: Thu May 26, 2016 8:44 am

Re: Execute SQl Query with a SQL data coumm data length [nvarchar](MAX) cause "allocation" error.

Postby agvinh » Fri Nov 24, 2017 5:58 am

I find a way to workaround by replacing the sql SELECT [Value] FROM [tbl_Config] WHERE Variable = 'Val1' with the following:

DECLARE @val AS NVARCHAR(500)
SELECT @val = [Value] FROM [tbl_Config] WHERE [Variable] = 'Val1'
SELECT @val


Now it works as I expected

Daniel
Posts: 6507
Joined: Mon Apr 02, 2012 1:11 pm
Contact:

Re: Execute SQl Query with a SQL data coumm data length [nvarchar](MAX) cause "allocation" error.

Postby Daniel » Mon Nov 27, 2017 4:42 pm

Hello and welcome to our forums,

I'm glad you found a workaround solution.

We'll also start investigating your first query scenario which didn't work and get back to you as soon as we have a conclusion.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Daniel
Posts: 6507
Joined: Mon Apr 02, 2012 1:11 pm
Contact:

Re: Execute SQl Query with a SQL data coumm data length [nvarchar](MAX) cause "allocation" error.

Postby Daniel » Sat Dec 09, 2017 9:11 am

Hello again,

We have further investigated this and indeed seems to be an Advanced Installer issue. A fix will be available in a future version of Advanced Installer, thank you for bringing this to our attention.

We will update this thread as soon as the fix will be available.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube


Return to “Common Problems”

Who is online

Users browsing this forum: Bing [Bot] and 2 guests