dbTalk Databases Forums  

(using CONVERT in PassThrough qry) to view sql server field in ACCESS

comp.databases.ms-access comp.databases.ms-access


Discuss (using CONVERT in PassThrough qry) to view sql server field in ACCESS in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Tony_E
 
Posts: n/a

Default (using CONVERT in PassThrough qry) to view sql server field in ACCESS - 04-07-2011 , 08:58 AM






Hello; Access 2000 sql server 2000;

I have a sql server table linked into my access db.
One of the fields is OLE dtype in Access-binary in sql server.
I have built a passthrough query to view this data.
Could someone assist me with the syntax for the CONVERT function?

I tried: CONVERT(varchar(25), BITS, text). BITS is the field name.
I get an error message stating that text is not a valid column name.
I am using the help explanation of:

CONVERT(data_type(length),data_to_be_converted,sty le)

Anybody ever try this?

Thanks
Tony

Reply With Quote
  #2  
Old   
Bob Barrows
 
Posts: n/a

Default Re: (using CONVERT in PassThrough qry) to view sql server field in ACCESS - 04-07-2011 , 09:13 AM






Tony_E wrote:
Quote:
Hello; Access 2000 sql server 2000;

I have a sql server table linked into my access db.
One of the fields is OLE dtype in Access-binary in sql server.
I have built a passthrough query to view this data.
Could someone assist me with the syntax for the CONVERT function?

I tried: CONVERT(varchar(25), BITS, text). BITS is the field name.
I get an error message stating that text is not a valid column name.
I am using the help explanation of:

CONVERT(data_type(length),data_to_be_converted,sty le)

The style argument is a number that controls the format of data to be
output. It is optional. For example, when converting a datetime to char, you
can use the style argument to control how the resulting string is formatted:
0 or 100 is the default mon dd yyyy hh:miAM(or PM)
101 mm/dd/yyyy
1 mm/dd/yy
8 hh:mm:ss
etc.

For
Try CONVERT(varchar(25), BITS)

Reply With Quote
  #3  
Old   
Bob Barrows
 
Posts: n/a

Default Re: (using CONVERT in PassThrough qry) to view sql server field in ACCESS - 04-07-2011 , 09:16 AM



Tony_E wrote:
Quote:
Hello; Access 2000 sql server 2000;

I have a sql server table linked into my access db.
One of the fields is OLE dtype in Access-binary in sql server.
I have built a passthrough query to view this data.
Could someone assist me with the syntax for the CONVERT function?

I tried: CONVERT(varchar(25), BITS, text). BITS is the field name.
I get an error message stating that text is not a valid column name.
I am using the help explanation of:

CONVERT(data_type(length),data_to_be_converted,sty le)

Oops - accidently hit Send somehow.

There do not seem to be style settings for binary data, so simply leave off
the optional style argument

Reply With Quote
  #4  
Old   
Tony_E
 
Posts: n/a

Default Re: (using CONVERT in PassThrough qry) to view sql server field in ACCESS - 04-07-2011 , 09:25 AM



On Apr 7, 10:13*am, "Bob Barrows" <reb01... (AT) NOyahooSPAM (DOT) com> wrote:
Quote:
Tony_E wrote:
Hello; Access 2000 sql server 2000;

I have a sql server table linked into my access db.
One of the fields is OLE dtype in Access-binary in sql server.
I have built a passthrough query to view this data.
Could someone assist me with the syntax for the CONVERT function?

I tried: * CONVERT(varchar(25), *BITS, text). BITS is the field name.
I get an error message stating that text is not a valid column name.
I am using the help explanation of:

* *CONVERT(data_type(length),data_to_be_converted,st yle)

The style argument is a number that controls the format of data to be
output. It is optional. For example, when converting a datetime to char, you
can use the style argument to control how the resulting string is formatted:
0 or 100 is the default mon dd yyyy hh:miAM(or PM)
101 * * * * * * * * * * * * * * mm/dd/yyyy
1 * * * * * * * * * * * * * * * * mm/dd/yy
8 * * * * * * * * * * * * * * * *hh:mm:ss
etc.

For
Try CONVERT(varchar(25), *BITS)
Hello;
Thanks for the quick response. I tried CONVERT(Varchar(25),BITS)

I got the message: ODBC call failed
Sql Server Driver explicit conversion
from data type image to varchar
not allowed.

I bet the solution is something close to this though.

Reply With Quote
  #5  
Old   
Bob Barrows
 
Posts: n/a

Default Re: (using CONVERT in PassThrough qry) to view sql server field in ACCESS - 04-07-2011 , 09:35 AM



Tony_E wrote:
Quote:
On Apr 7, 10:13 am, "Bob Barrows" <reb01... (AT) NOyahooSPAM (DOT) com> wrote:
Tony_E wrote:
Hello; Access 2000 sql server 2000;

I have a sql server table linked into my access db.
One of the fields is OLE dtype in Access-binary in sql server.
I have built a passthrough query to view this data.
Could someone assist me with the syntax for the CONVERT function?

I tried: CONVERT(varchar(25), BITS, text). BITS is the field name.
I get an error message stating that text is not a valid column name.
I am using the help explanation of:


Hello;
Thanks for the quick response. I tried CONVERT(Varchar(25),BITS)

I got the message: ODBC call failed
Sql Server Driver explicit conversion
from data type image to varchar
not allowed.

I bet the solution is something close to this though.
image datatype <> binary datatype. As the error says, direct conversions
from image to varchar are not allowed. You need to first convert the image
to binary, and then convert the result to varchar. You can nest the calls
like this

CONVERT(Varchar(25),CONVERT(varbinary(25),BITS))

You can also use CAST, if you want, instead of CONVERT since no style
setting is possible or needed:

CAST(CAST(BITS As varbinary(25)) AS varchar(25))

Reply With Quote
  #6  
Old   
Tony_E
 
Posts: n/a

Default Re: (using CONVERT in PassThrough qry) to view sql server field in ACCESS - 04-07-2011 , 09:48 AM



On Apr 7, 10:35*am, "Bob Barrows" <reb01... (AT) NOyahooSPAM (DOT) com> wrote:
Quote:
Tony_E wrote:
On Apr 7, 10:13 am, "Bob Barrows" <reb01... (AT) NOyahooSPAM (DOT) com> wrote:
Tony_E wrote:
Hello; Access 2000 sql server 2000;

I have a sql server table linked into my access db.
One of the fields is OLE dtype in Access-binary in sql server.
I have built a passthrough query to view this data.
Could someone assist me with the syntax for the CONVERT function?

I tried: CONVERT(varchar(25), BITS, text). BITS is the field name.
I get an error message stating that text is not a valid column name.
I am using the help explanation of:

Hello;
Thanks for the quick response. I tried CONVERT(Varchar(25),BITS)

I got the message: ODBC call failed
* * * * * * * * * * * * * * *Sql Server Driver explicit conversion
from data type image to varchar
* * * * * * * * * * * * * * *not allowed.

I bet the solution is something close to this though.

image datatype <> binary datatype. As the error says, direct conversions
from image to varchar are not allowed. You need to first convert the image
to binary, and then convert the result to varchar. You can nest the calls
like this

CONVERT(Varchar(25),CONVERT(varbinary(25),BITS))

You can also use CAST, if you want, instead of CONVERT since no style
setting is possible or needed:

CAST(CAST(BITS As varbinary(25)) AS varchar(25))- Hide quoted text -

- Show quoted text -
That seems to work. I might have a different problem. I view the
output when I run the query
and all that displays in that binary field is the first character.
All the records that were appended
through an Access append query have the same symptom. Yet, other
records, that were input via a window
in our ERP application, display the full text value.

Do you think that appending to a binary field (when the data being
appended is only simple text)
might not fully succeed?

It just seems odd that only the first character would appear.

If you have any theories I would be willing to read them.

Thanks very much.

Tony

Reply With Quote
  #7  
Old   
Bob Barrows
 
Posts: n/a

Default Re: (using CONVERT in PassThrough qry) to view sql server field in ACCESS - 04-07-2011 , 10:07 AM



Tony_E wrote:
Quote:
That seems to work. I might have a different problem. I view the
output when I run the query
and all that displays in that binary field is the first character.
All the records that were appended
through an Access append query have the same symptom. Yet, other
records, that were input via a window
in our ERP application, display the full text value.

Do you think that appending to a binary field (when the data being
appended is only simple text)
might not fully succeed?

It just seems odd that only the first character would appear.

If you have any theories I would be willing to read them.

None. As I said before, I've never dealt with this datatype. Sorry.

Reply With Quote
  #8  
Old   
Tony_E
 
Posts: n/a

Default Re: (using CONVERT in PassThrough qry) to view sql server field in ACCESS - 04-07-2011 , 10:10 AM



On Apr 7, 11:07*am, "Bob Barrows" <reb01... (AT) NOyahooSPAM (DOT) com> wrote:
Quote:
Tony_E wrote:

That seems to work. I might have a different problem. I view the
output when I run the query
and all that displays in that binary field is the first character.
All the records that were appended
through an Access append query have the same symptom. Yet, other
records, that were input via a window
in our ERP application, display the full text value.

Do you think that appending to a binary field (when the data being
appended is only simple text)
might not fully succeed?

It just seems odd that only the first character would appear.

If you have any theories I would be willing to read them.

None. As I said before, I've never dealt with this datatype. Sorry.- Hidequoted text -

- Show quoted text -
Ok thanks
I will keep pluggin away

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.