how to cast a varchar(50) to sql in teradata with vba

  • Hi all,


    I use excel vba to creat a sql query and get data from Teradata database. Recently the changed a field into alphanumeric and I can't use my query as I get error when passin the customer_id
    here are some of the parts:


    (I have this in a userform)



    the CUSTOMER_ID is set Varchar(50) and is alphanumeric


    this really drives me crazy.


    Greetings.

  • Re: how to cast a varchar(50) to sql in teradata with vba


    Hi al,


    Any possible solution?
    I just need to kind of convert or cast the content of the variable "clientnr" to the sql query made via VBA.
    I spent hours reading on the Cast in SQL, but I can't figure out how to make use of it.


    If some one could point me in the right direction, that would be already great.


    Greetings.

  • Re: how to cast a varchar(50) to sql in teradata with vba


    A VARCHAR field is simply a variable length text field, so I'd assume you just need to delimit the string


    Code
    ... Where ((CUSTOMER_ID)= '" & clientnr & "')"


    Not very clear so expanded: ... Where ((CUSTOMER_ID)= ' " & clientnr & " ' )"

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!