From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Jens Sorensen (Intuii) <JensSorensen@Intuii.com>
To: pgsql-odbc@postgresql.org
Subject: Re: PSQLODBC.DLL - The (maximum) expected data length is 8000, while the returned data length is 9606.
Date: Wed, 29 Jul 2015 12:03:37 -0700
Message-ID: <55B92389.30100@aklaver.com> (raw)
In-Reply-To: <cb6ec01d0c982$b2788a40$17699ec0$@Intuii.com>
References: <4854fc01d0c6cb$fc0c0010$f4240030$@Intuii.com>
<55B656AD.6020800@aklaver.com>
<8FB820A2-C966-42A5-B5D2-BA4BA7170BC3@Intuii.com>
<55B6609A.7070108@aklaver.com>
<ca4501d0c8fd$4029b2a0$c07d17e0$@Intuii.com>
<55B780BD.6000700@aklaver.com>
<cb6ec01d0c982$b2788a40$17699ec0$@Intuii.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>
On 07/28/2015 03:13 PM, Jens Sorensen (Intuii) wrote:
> Adrian>> You are doing a server to server transformation where psqlodbc
> is just one component in the mix. It would be helpful to have the entire
> transformation laid out in schematic for:
>
> Adrian>> Postgres --> psqlodbc ????? --> SQL Server
>
> I’m not sure how to lay this “out in schematic”, but hopefully what
> follows will provide the info you need.
Heavily edited, to get to point:)
I have to believe your problem is in the below. From here:
https://msdn.microsoft.com/en-us/library/ms190312.aspx
"OPENROWSET(BULK...) assumes that, if not specified, the maximum length
of SQLCHAR, SQLNCHAR or SQLBINARY data does not exceed 8000 bytes."
I know you are not using BULK, but I am betting it making the same
assumption when you are not using. Doing some searching I see the 8000
limit coming up often, however I have not found a definitive solution.
You might get an answer faster if you ask this on a SQL Server mailing
list/forum.
As to your cast problems:
https://msdn.microsoft.com/en-us/library/ms187928.aspx
"text and image Data Types
Automatic data type conversion is not supported for the text and image
data types. You can explicitly convert text data to character data, and
image data to binary or varbinary, but the maximum length is 8000 bytes.
If you try an incorrect conversion such as trying to convert a character
expression that includes letters to an int, SQL Server returns an error
message."
Which is what you are trying to do here:
CAST(log.uri AS varchar(max)) AS uri,
>
> -- =============================================
>
> -- Description: Retrieves the HTTP Events Log entries from Untangle
>
> -- =============================================
>
> CREATE PROCEDURE [dbo].[RetrieveHttpEvents]
>
> AS
>
> BEGIN
>
> SET NOCOUNT ON;
>
> declare
>
> @NumRowsChanged int = 0;
>
> declare
>
> @ErrorCode int;
>
> INSERT http_events
>
> SELECT *
>
> FROM openrowset
>
> (
>
> 'MSDASQL',
>
> 'Dsn=PostgreSQL35W;',
>
> 'Select
>
> event_id,
>
> time_stamp,
>
> session_id,
>
> client_intf,
>
> server_intf,
>
> c_client_addr,
>
> s_client_addr,
>
> c_server_addr,
>
> s_server_addr,
>
> c_client_port,
>
> s_client_port,
>
> c_server_port,
>
> s_server_port,
>
> policy_id,
>
> username,
>
> hostname,
>
> request_id,
>
> method,
>
> uri,
>
> host,
>
> c2s_content_length,
>
> s2c_content_length,
>
> s2c_content_type,
>
> adblocker_blocked,
>
> adblocker_cookie_ident,
>
> adblocker_action,
>
> webfilter_reason,
>
> webfilter_category,
>
> webfilter_blocked,
>
> webfilter_flagged,
>
> sitefilter_reason,
>
> sitefilter_category,
>
> sitefilter_blocked,
>
> sitefilter_flagged,
>
> clam_clean,
>
> clam_name,
>
> virusblocker_clean,
>
> virusblocker_name
>
> FROM reports.http_events AS log'
>
> )
>
> END
>
> GO
>
> Adrian>> Remember we are not looking at your set up directly, we only
> have what you provide and the more you provide the better.
>
> I understand. Let me know if there is anything else I can provide you.
>
> Jon>>I believe your problem is that SQL Server is determining how to
> translate the data types. You might have better luck casting the column
> to varchar(max) (or to text)
>
--
Adrian Klaver
adrian.klaver@aklaver.com
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: adrian.klaver@aklaver.com, JensSorensen@Intuii.com
Subject: Re: PSQLODBC.DLL - The (maximum) expected data length is 8000, while the returned data length is 9606.
In-Reply-To: <55B92389.30100@aklaver.com>
References: <4854fc01d0c6cb$fc0c0010$f4240030$@Intuii.com> <55B656AD.6020800@aklaver.com> <8FB820A2-C966-42A5-B5D2-BA4BA7170BC3@Intuii.com> <55B6609A.7070108@aklaver.com> <ca4501d0c8fd$4029b2a0$c07d17e0$@Intuii.com> <55B780BD.6000700@aklaver.com> <cb6ec01d0c982$b2788a40$17699ec0$@Intuii.com> <55B92389.30100@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox