Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZKWeM-0006E4-G2 for pgsql-odbc@arkaria.postgresql.org; Wed, 29 Jul 2015 19:04:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZKWeL-00043U-Sf for pgsql-odbc@arkaria.postgresql.org; Wed, 29 Jul 2015 19:04:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZKWdy-0003Cg-OF for pgsql-odbc@postgresql.org; Wed, 29 Jul 2015 19:03:58 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZKWdu-0005Bp-SK for pgsql-odbc@postgresql.org; Wed, 29 Jul 2015 19:03:58 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id D0B8720F57 for ; Wed, 29 Jul 2015 15:03:49 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Wed, 29 Jul 2015 15:03:49 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=QiEdVXVvFXfH9VGOaZ6MUrHp3yw=; b=AaWA3i WpfyCokSqTVXLuvakKyzGQ8Gi6ogCHNYibO1qlOmHflYP/FP9S2pPeYDtX+fp2zX s9asH3pFYmU9o7cUjap7M0q6CepXVgiRl5hOsI4ySifAYKtuNCWvzxgYfEoPRa1P S77E46wQROcJo2OG1Sid4m4TJSw54+RL39vfE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=QiEdVXVvFXfH9VG OaZ6MUrHp3yw=; b=DtvzC6LEOsFDi1IzvNDjIgAFRVf1JOgSMRsXU85IjUu/sYN puGNHksXsr/o4Vu2jVv10bC3WQpnDI2W1o1tnTkBOFjfDQ0VwBD/Taymo6RIwJSQ U2pAJXnEKW+W62BX/0jk7TRQYhkqFibVvMTxMGbC1Fe2duCg1b78ff1OMWXc= X-Sasl-enc: RL+TDc2YstJFbHrxnFQjj2pRri5FduxbhZ5NSxBLjgYQ 1438196629 Received: from [192.168.1.2] (97-113-26-19.tukw.qwest.net [97.113.26.19]) by mail.messagingengine.com (Postfix) with ESMTPA id 4E26268011F; Wed, 29 Jul 2015 15:03:49 -0400 (EDT) Subject: Re: PSQLODBC.DLL - The (maximum) expected data length is 8000, while the returned data length is 9606. To: "Jens Sorensen (Intuii)" , pgsql-odbc@postgresql.org References: <4854fc01d0c6cb$fc0c0010$f4240030$@Intuii.com> <55B656AD.6020800@aklaver.com> <8FB820A2-C966-42A5-B5D2-BA4BA7170BC3@Intuii.com> <55B6609A.7070108@aklaver.com> <55B780BD.6000700@aklaver.com> From: Adrian Klaver Message-ID: <55B92389.30100@aklaver.com> Date: Wed, 29 Jul 2015 12:03:37 -0700 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org 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