Information générale
Catégorie:
Code, syntaxe and commandes
Hi Naomi.
Yes , that was nearly it.
I had my Table defined as NVarChar , When I Added the parameter in C#, I defined it as VarChar.... did not realise that this would make such a difference !!
Many thanks for sorting it
Gerard
>Oops, now I see - you declared your @CustName as char(30). It should be varchar(30).
>
>>Hi Naomi. Thnaks for replying.
>>
>>Tried that and it makes no difference
>>Regards,
>>Gerard
>>
>>>I have the following TSQL statements and cannot get the statement WITH the parameter to return any row ?
>>>>
>>>>Declare @Cusname char(30)
>>>>set @Cusname = '%Gal%'
>>>>SELECT MYNAME From MyTable Where MYNAME like '%Gal%' Retruns 3 rows
>>>>
>>>>
>>>>SELECT MYNAME From MyTable Where Myname like @Cusname Returns zero rows
>>>>
>>>>Why is the statement WITH the parameter not returning any rows ??
>>>>(If I use the equal symbol and select an exact match, both statements work)
>>>>
>>>>Tia
>>>>Gerard
>>>>
>>>Remove '%' from the @CusName parameter and try
>>>
>>>select MyName from MyTable where MyName LIKE '%' + @CustName + '%'
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement