Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SP returning no records
Message
 
 
À
26/11/2012 11:13:28
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01558050
Message ID:
01558068
Vues:
32
>>>>What is fred doing at the end of your code - was it for test? Add print @SQL before executing, you will see the error.
>>>>
>>>
>>>See my reply to Boris.
>>
>>You have an extra + before like.
>>
>>It should be
>>
>>where myField LIKE '%' + @SomeNumber + '%'
>>
>
>I am concatenating strings, this is my current code:
>
>
SET @sWhereClause = @sWhereClause + @NewLine + ' AND [cus_number] LIKE + ''%'' + @cus_Number + ''%'''
>
>strangely enough it works as is, but I'm not quite understanding how the string concatenation is working here anyhow.
>
>>Also, if the number is nchar(5) when what is the point of using LIKE at all? You should use
>>
>>Number = @SomeNumber
>
>See my conversation with Boris regarding this.

In this string above you don't need + before LIKE.

I saw your conversation with Boris and that is why I am saying you need to use = instead of LIKE for the number. Since you always provide the full number (all 5 chars) and the number is 5 chars in the table, there is no sense to use LIKE.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform