views:

13

answers:

1

This one DOES NOT work fine:

ALTER PROCEDURE rconte.spPesquisaPesIdDadoCodigo24
    (
    @pPesCodigo24 char
    )
    AS
    SELECT pesId FROM tblPesquisas where pesIdentificadorRandomico24ParaEmail = @pPesCodigo24
    RETURN

This one WORKS FINE:

ALTER PROCEDURE rconte.spPesquisaPesIdDadoCodigo24
    (
    @pPesCodigo24 char(24)
    )
    AS
    SELECT pesId FROM tblPesquisas where pesIdentificadorRandomico24ParaEmail = @pPesCodigo24
    RETURN

Why, please ?

+1  A: 

Becuase by default the length is 1

But it depends on how you use it

Also make sure to read this

http://beyondrelational.com/blogs/madhivanan/archive/2007/12/04/column-length-and-data-length.aspx

Madhivanan
Does that mean that if the parm value is 'abcdef' the comparison will be made as where pesIdentificadorRandomico24ParaEmail = 'a'ignoring the rest of the string, resulting in "no match" at all ?
Ricardo Conte
Yes. Try it and see
Madhivanan