Author |
Message
|
rmp |
Posted: Sun Sep 22, 2013 3:07 am Post subject: How do I load varchar(max)/varbinary(max) contents into ESQL |
|
|
Newbie
Joined: 22 Sep 2013 Posts: 1
|
I have a T-SQL stored procedure in a SQL Server 2012 that I must call using an Integration Service in IIB v9 and return the output in a SOAP message.
I'm able to connect IIB to SQL Server using an ODBC setting (SQL Server Native Client 11.0).
I'm experiencing trouble with columns in the returned result set with varchar(max) and varbinary(max) types. Nonetheless, I can use without problems varbinary(N) or varchar(N), being N a value between 0 and 8000.
I have an ESQL Compute Node in our flow that calls the stored procedure, but to simplify things in the resolution and explanation of this problem, I have the following simple ESQL code to get an image in a varbinary(max) column:
set Environment.Response.row =
select max( T.Picture )
from Database."<name of our ODBC connection>".dbo.OurTableWithPictures as T;
It works if the Picture column is varbinary( N ) but not with varbinary ( max ). If I create a column with a "cropped" version of the original contents (e.g. a varbinary(8000) column with the first 8000 bytes of the original varchar(max) column), it works. So it's probably nothing about contents, but types.
When using varbinary( max ) the error that occurs in IIB is:
Text:CHARACTER:[Microsoft][SQL Server Native Client 11.0]String data, right truncation
When using stored procedure returning varchar( max ) in an output parameter, we get:
Text:CHARACTER:[Microsoft][SQL Server Native Client 11.0]Invalid precision value
So far, I tried many different ways to get this information:
- in a varbinary(max) column in a result set of a stored procedure in SQL Server.
- in an output parameter of type varbinary(max) of a stored procedure in SQL Server.
- in the varbinary(max) return of a user-defined function (UDF) in SQL Server.
- in a direct query to a varbinary(max) column in a table [the example shown in this text].
- all of the above but converting varbinary contents to base64 using T-SQL, so that we returned varchar(max) instead of varbinary(max).
- also tried returning base64 but using 'text' type, but we get error messages telling that this type is deprecated.
Can anyone provide a working example of ESQL code for IIB v9 that calls a SQL Server T-SQL stored procedure, or UDF, or even a direct SQL query to the database, containing either a varchar(max) or varbinary(max) column in a rowset, in a output parameter or in the output of the UDF?
Or, can you tell us how can we get an image from SQL Server stored in varbinary(max) and place it in the output of an Integration Service.
Note that my stored procedure returns more stuff than the (small) images. Everything is working now as I hacked the T-SQL code to return NULL in the Picture output field instead of the Picture column's contents - but it means the Picture is missing.
I'm saying that because I'd like solutions that work with what I already have: an ESQL calling T-SQL stored procedure and returning the results in a XML defined in the schema. The final result for the image must be a base64 string in the SOAP message (XML). |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Sep 22, 2013 9:07 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Please raise a PMR for this.
Reference this thread. |
|
Back to top |
|
 |
mgk |
Posted: Sun Sep 22, 2013 1:43 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Yes, there is a fix for using varchar(max) that you need to apply and a PMR is the right way to get the fix.
Kind regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
mqjeff |
Posted: Sun Sep 22, 2013 2:53 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Any chance that APAR can be backported to v8? |
|
Back to top |
|
 |
zpat |
Posted: Sun Sep 22, 2013 11:48 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
I would hope and expect that all applicable APARs would be fixed on all currently supported versions without any special request being made. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
smdavies99 |
Posted: Sun Sep 22, 2013 11:52 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
zpat wrote: |
I would hope and expect that all applicable APARs would be fixed on all currently supported versions without any special request being made. |
I thought I saw a large inflatable Pig flying over Battersea Power Station yesterday...  _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
zpat |
Posted: Mon Sep 23, 2013 1:37 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Well, it was open to the public yesterday, but no sign of German-made inflatables. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
smdavies99 |
Posted: Mon Sep 23, 2013 1:59 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
zpat wrote: |
Well, it was open to the public yesterday, but no sign of German-made inflatables. |
I know. I was in the queue from just after 07:00. Thousands of people wanted to visit.
I got in just before 11am. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
|