Click here to Skip to main content
16,017,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have written a query ,but it's not running where is error please point me out.

SQL
CREATE PROCEDURE InsertName
(
`username` VARCHAR(300),
`password` VARCHAR(300)
)
AS
IF EXISTS (SELECT id FROM users WHERE `username` =`username` AND `password`=`password`)
ELSE 
BEGIN  
 INSERT INTO users
(
   `firstname`,`lastname`,`email`,`contact`,`username`,`password`,`sec_question`,`sec_answer`
)
VALUES
(
  `firstname`=`firstname`,`lastname`=`lastname`,`email`=`email`,`contact`=`contact`,`username`=`username`,`password`=`password`,
`sec_question`=`sec_question`,`sec_answer`=`sec_answer`
);
END;
Posted
Updated 2-Nov-11 20:46pm
v2

1 solution

follow the proper syntax for vreating stored procedure, in the first line itself u cannot declare 'firstname' it should be as:@firstname VARCHAR(300)

search for the stored procedures in google u can find there many more
 
Share this answer
 
v2
Comments
chinta123 3-Nov-11 6:36am    
thanks but i already mention that i am using mysql not sql.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900