Search code examples
c#sqlsql-serverstored-procedurestamil

Multi Language insertion in SQL Server using a stored procedure


I need to insert Tamil language into SQL Server 2005. I have tried using Insert or Update query, it worked fine. While going to stored procedure, I don't know how to pass the parameter.

ALTER PROCEDURE [dbo].[spr_Sam]
   @Row_Id       int            = NULL,
   @Description_Ta   nvarchar(MAX)  = null
AS
BEGIN
   update tblTest set  
   Description_Ta   = @Description_Ta
   where Row_Id = @Row_Id
END

exec [dbo].[spr_Sam] 2, 'பெண்டிரேம்';

If I execute this it gets inserted as ?????.

exec [dbo].[spr_Sam] 2, N'பெண்டிரேம்';

If I execute this it gets inserted correctly.. but I don't know how to pass that 'N' from my C# Application. I used a text-box to get that Description_Ta parameter.


Solution

  • Here is the correct update statement:

    update tblTest
        set  Description_Ta  = @Description_Ta
    where Row_Id = @Row_Id;
    

    You don't need single quotes around a variable.

    But, I think the posting is confused. To call the procedure use:

    exec [dbo].[spr_Sam] 2, N'பெண்டிரேம்';
    

    To modify it:

    ALTER PROCEDURE [dbo].[spr_Sam]     
        @Row_Id      int            = NULL,
        @Description_Ta  nvarchar(MAX)  = null
    AS
    BEGIN
        update tblTest
            set Description_Ta  = @Description_Ta
            where Row_Id = @Row_Id;
    END;
    

    You shouldn't have arguments when you define the stored procedure.