Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    11

    Unanswered: how i use the N' Switch in Stored Procedure

    Any One Tell me how i can use N'Switch in SQL Server Stored Procedure .
    When I use Such a this syntax i am encountered and stoped with a error.
    the is below(Stoerd Prdocedure Code)
    ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
    CREATE proc sp_check_userpass(@username nvarchar(50),@password nvarchar(50),@first nvarchar(50),@last nvarchar(50),@email nvarchar(50),@stage int )as
    declare @cnt int
    begin
    select @cnt=count(*) from member_info where (@username=username and @password=password)
    if(@cnt=0)
    begin
    insert into atable(first,last,username,password,stage) values(@first,@last,@username,@password,@stage)
    end
    else
    return @cnt
    end
    GO
    ~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
    Other thing is that when exec this store proc it must be return a value return back to the @cnt but it is return only This( The command(s) Completed succefully).
    Any One guide me how i can must be do .
    i must clear it that i am using this query in ASP.NET SqlClient Object To Execute Query.
    Thanx In Advance. ArQa

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I can't see any use of the unicode string constant prefix (i.e. N'Hello world') in your procedure. Did I miss something?

    A UDF (User Defined Function) might better suit your needs than a stored procedure, although a UDF couldn't write to a table in order to log the failure for you. Very few client tools have the ability to support return values from stored procedures, although that is possible in most of the languages that support ADO.NET. You can get more information about this in KB#308051.

    -PatP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •