showing error my procedure

  • hai freinds

    i wrote the query for login page if already user again registered means it ll through error unfortunately my query display in valid column of "EMAIL".

    CREATE PROCEDURE sp_userinformation

    (

    @UserName varchar(50),

    @Password varchar(50),

    @FirstName varchar(50),

    @LastName varchar(50),

    @Email varchar(50),

    @PhoneNo varchar(50),

    @Location varchar(50),

    @Created_By varchar(50),

    @ERROR VARCHAR(100)

    )

    AS

    BEGIN

    SET NOCOUNT ON;

    IF NOT EXISTS(SELECT * FROM User_Information WHERE UserName=@UserName)

    BEGIN

    INSERT INTO User_Information

    (

    UserName,

    [Password],

    FirstName,

    LastName,

    Email,

    PhoneNo,

    Location,

    Created_By

    )

    VALUES

    (

    @UserName,

    @Password,

    @FirstName,

    @LastName,

    @Email,

    @PhoneNo,

    @Location,

    @Created_By

    )

    SET @ERROR=@UserName+' Registered Successfully'

    END

    ELSE

    BEGIN

    SET @ERROR=@UserName + ' Already Exists'

    END

    END

  • The error is saying that there is no EMAIL column in the table User_Information.

    Try this: -

    SELECT name

    FROM sys.columns

    WHERE [object_id] = OBJECT_ID('dbo.User_Information');

    That should list all of your column names for that table. Check for EMAIL and I bet it's not there.


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Viewing 2 posts - 1 through 1 (of 1 total)

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