Re: Funky Error
From: Darrick (anonymous_at_discussions.microsoft.com)
Date: 03/04/04
- Next message: Darrick: "Re: Joing each byte of a field to another table...?"
- Previous message: Brandon Lilly: "Re: More time series questions"
- In reply to: Erland Sommarskog: "Re: Funky Error"
- Next in thread: Erland Sommarskog: "Re: Funky Error"
- Reply: Erland Sommarskog: "Re: Funky Error"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 4 Mar 2004 05:32:11 -0800
Thanks Erland. You are absolutly right about the remote
DB being on a UNIX platform. The DB is a SIMBA DB, which
can only be accessed through an ODBC driver. (Which makes
it more diffucult). Anyhow, I tried your statement, and
it returned the following error. Do you hav any more
suggestions?
Server: Msg 7321, Level 16, State 2, Line 1
An error occurred while preparing a query for execution
against OLE DB provider 'MSDASQL'.
[OLE/DB provider returned message: [SimbaLNA][Simba]
[SimbaEngine ODBC Driver]Syntax Error.]
[OLE/DB provider returned message: [SimbaLNA][Simba]
[SimbaEngine ODBC Driver]SELECT CAST(SCHEDULE as<< ??? >>
binary(1440)) FROM [/usr/prms/run/db/statdb]..[schedule]]
OLE DB error trace [OLE/DB Provider 'MSDASQL'
ICommandPrepare::Prepare returned 0x80040e14].
Thanks again,
Darrick
>-----Original Message-----
>Steve Kass (skass@drew.edu) writes:
>> I'll take a shot at this. Are you storing data in a
char() or
>> varchar() column that contains non-printable
characters, and in
>> particular, some char(0) values? The char and varchar
types are not
>> meant to store char(0) as data, and the provider is
probably seeing this
>> as an end-of-string marker. If you want to store a
string of 1440 bytes
>> that can include char(0) or any value, my advice is
that you use
>> binary(1440) instead of char(1440), since binary types
are designed for
>> storing arbitrary binary information, unlike character
types, which are
>> used for storing text. Storing binary data in
character types can raise
>> all kinds of issues, like code page conversion,
collations,
>> case-insensitive comparison results, etc, none of which
you probably want.
>
>I tried this on a remote server:
>
> CREATE TABLE baddata (a char(1440) NOT NULL)
> go
> insert baddata (a)
> values (replicate('ABC', 9) + char(0) + replicate
('XUZ', 2))
>
>And I was able to query the remote server with both
MSDASQL and SQLOLEDB
>without getting any error message.
>
>However, looking at Darrick's error message a little
closer, it does
>not seem that his remote server is SQL Server, because
the error message
>says:
>
> [LINKED-TOTALVIEWDB].[/usr/prms/run/db/statdb]..
[schedule].SCHEDULE
>
>Which has a distinct Unix flavour over it. And to get
stuff on Unix to
>understand that char(0) is data and not a string
terminator... Good luck!
>
>One alternative to try could be to use OPENQUERY, as this
could permit
>you to perform the conversion on the remote server. Here
is an example:
>
> SELECT schedule FROM OPENQUERY(LINKED-TOTALVIEWDB,
> 'SELECT CAST(SCHEDULE as binary(1440))
> FROM [/usr/prms/run/db/statdb]..[schedule]')
>
>The syntax may need to be adapted to that other DB engine.
>
>
>--
>Erland Sommarskog, SQL Server MVP, sommar@algonet.se
>
>Books Online for SQL Server SP3 at
>http://www.microsoft.com/sql/techinfo/productdoc/2000/book
s.asp
>.
>
- Next message: Darrick: "Re: Joing each byte of a field to another table...?"
- Previous message: Brandon Lilly: "Re: More time series questions"
- In reply to: Erland Sommarskog: "Re: Funky Error"
- Next in thread: Erland Sommarskog: "Re: Funky Error"
- Reply: Erland Sommarskog: "Re: Funky Error"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|