Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to import an excel table into sql server express? | Excel Programming | |||
Finding text in a cell and returning a value based on that text | Excel Discussion (Misc queries) | |||
Returning Values from a Table | Excel Discussion (Misc queries) | |||
Does Pivot Table express numbers in "thousands (000's)"? | Excel Discussion (Misc queries) | |||
Returning row # using match or index of repeated text in a complex table | Excel Worksheet Functions |