View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Nuno Gomes Nuno Gomes is offline
external usenet poster
 
Posts: 2
Default [Microsoft][ODBC SQL Server Driver]String data, right truncation

Hello all,

I need help in the this situation:

I have a ODBC connection to a SQL Server with the following query:
=============================================
select S.fam_code FAM, S.fam_nom NOME,
(
select sum(SB.vn_atelier)+sum(SB.vn_loja) from roa_stat01_det_f SB
where SB.dt='20100101' and SB.dt<='20100110' and SB.fam_code=S.fam_code
)[VN PDV]
from roa_stat01_det_f S
where S.dt='20100101' (**)
and S.dt<='20100110'
group by S.fam_code, S.fam_nom
order by 1
=============================================
This works ok!

Then i change the string parameters '20100101' and '20100110' to '?' in the
the command text inside the Excel and say that de parameter '20100101' is
the cell A1 and the parameter '20100110' is the cell A2.
This method work fine while i don't add a third parameter (the **). When i
add the third parameter i say the cell with the value is again A1 and the
error '[Microsoft][ODBC SQL Server Driver] String Data, rigth truncation'
appears.

The problem is that the parameters cannot be referenced from the same cell.

How can i solve the problem?
Thanks any ideas...


Nuno Gomes