General information
Category:
Coding, syntax and commands
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 + '%'
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only