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

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

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.52KiB)Downloaded 350 times
logB637.log
(117.43KiB)Downloaded 281 times

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

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

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: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

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

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: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

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

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

Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

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

Wed Feb 21, 2018 1:59 pm

Hello,

This was fixed in version 14.6 of Advanced Installer released on February 19th, 2018.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”