an sproc with a unicode parameter

  • Hello ,

    I want to execute a sproc from my code ,

    but I get no results ,

    I tried that inside ssms but the result was same

    what is wrong with this sproc :

    ---------

    CREATE PROCEDURE [dbo].[GetProductsByTagTable]

    ( @TagSelected nvarchar(20) ) AS

    SELECT ROW_NUMBER() OVER (ORDER BY id) AS Row ,

    id , Title , Users , Technology , [Image]

    FROM Products p

    JOIN [TagProducts] tp ON p.[id]=tp.[ProductID]

    JOIN [Tags] t ON t.[TagID]=tp.[TagID]

    WHERE N'@TagSelected' = t.[TagTitle]

    GO

    ----------

    USE PDD

    Exec GetProductsByTagTable

    @TagSelected = 'مالی'

    ----------

    It should give to records ,

    and when I put the item inside the sproc itself it shows

    the 2 desired records

  • Hello,

    What results do you get if the Where clause uses the following syntax:-

    WHERE @TagSelected = t.[TagTitle]

    And you call the SP as follows:-

    Exec GetProductsByTagTable @TagSelected = N'????'

    What Data-Type is the column TagTitle?

    Regards,

    John Marsh

    www.sql.lu
    SQL Server Luxembourg User Group

  • What is the collation setting for the column and then again for the database? If you explicitly define the proper collation in the where clause does it work in the stored procedure?

    WHERE columnname = @parametername COLLATE

    Jonathan Kehayias | Principal Consultant | MCM: SQL Server 2008
    My Blog | Twitter | MVP Profile
    Training | Consulting | Become a SQLskills Insider
    Troubleshooting SQL Server: A Guide for Accidental DBAs[/url]

  • I am pretty sure that John Marsh has the answer there. Looks like the OP incorrectly quoted the parameter's name in the WHERE clause.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • I solved the issue next to my post ,

    I think you are right ,

    the problem was because of the N Identifier & quotations ,

    excuse me for the delay ,

    really thanks

  • glad we could help

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply