Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default QueryTables.Add() not returning text from SQL Express table

Hello all,

Using Excel 2003 and SQL Server 2005 Express.

I have a simple database table with 3 fields:

Field_1: integer
Field_2: string
Field_3: decimal(4,2)

Using QueryTables.Add() in an Excel macro, I'm trying to retrieve one
record, i.e. one integer, one string and one decimal into cells. Strangely,
I'm getting the numbers back but not the string. The cell where the string
should appear is empty. I verified the SQL command and there is no error. The
string is properly queried along with the numbers.

In an effort to troubleshoot the problem, I tried importing the data
directly into a cell using Import External Data and I get the same results. I
can import any number from the database table but not the text. Weird.

Any ideas?

Thanks.

Daniel Leger


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default QueryTables.Add() not returning text from SQL Express table

OK, the problem occurs if you declare your database field as Varchar(MAX).
The problem dissapears if the field is changed to a fixed length field, e.g.
Varchar(500).

D. Leger



"D. Leger" wrote:

Hello all,

Using Excel 2003 and SQL Server 2005 Express.

I have a simple database table with 3 fields:

Field_1: integer
Field_2: string
Field_3: decimal(4,2)

Using QueryTables.Add() in an Excel macro, I'm trying to retrieve one
record, i.e. one integer, one string and one decimal into cells. Strangely,
I'm getting the numbers back but not the string. The cell where the string
should appear is empty. I verified the SQL command and there is no error. The
string is properly queried along with the numbers.

In an effort to troubleshoot the problem, I tried importing the data
directly into a cell using Import External Data and I get the same results. I
can import any number from the database table but not the text. Weird.

Any ideas?

Thanks.

Daniel Leger


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to import an excel table into sql server express? Ben Excel Programming 1 July 4th 07 06:39 AM
Finding text in a cell and returning a value based on that text [email protected] Excel Discussion (Misc queries) 5 January 10th 07 06:01 PM
Returning Values from a Table snmcpa Excel Discussion (Misc queries) 5 November 27th 06 03:04 AM
Does Pivot Table express numbers in "thousands (000's)"? Excelable Excel Discussion (Misc queries) 2 April 16th 06 01:05 AM
Returning row # using match or index of repeated text in a complex table General Excel Worksheet Functions 10 October 21st 05 03:06 PM


All times are GMT +1. The time now is 05:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"