Click here to Skip to main content
15,935,728 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
Hello i am newbie to MYSQL Database .... i want to create stored procedure in MYSQL .. I have written the same procedure in MSSQL and it was running but when i am running it in PHPMYADMIN(MYSQL) its is giving error:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@'companyna' nvarchar(150)<br />
begin<br />
select Company_Name from companynames<br />
where ' at line 2




this is my MS SQL Stored Procedure
SQL
create proc spgetcompanynames
@companyna nvarchar(150)
as
begin
select Company_Name from companynames
where Company_Name Like @companyna + '%'
end



this is my MYSQL Stored Procedure


SQL
create procedure spGetCompanyNames
@CompanyNams varchar(250)
begin
select Company_Name from companynames
where Company_Name Like @CompanyNams + '%'
end


Plz Help me in finding the error .
Posted
Updated 3-Aug-14 2:00am
v2
Comments

try this....

SQL
Create procedure spGetComapnyNames(IN companyname varchar(150))
BEGIN
select Company_Name from companynames
where Company_Name Like companyname + '%'
END 
 
Share this answer
 
Close!
Try:
SQL
create procedure spGetCompanyNames
(@CompanyNams varchar(250))
begin
select Company_Name from companynames
where Company_Name Like @CompanyNams + '%'
end
 
Share this answer
 
Comments
himanshuchawla4393 3-Aug-14 13:58pm    
Its not Working .... Still there is error !!
create proc spgetcompanynames
@companyna nvarchar(150)
as
begin
select Company_Name from companynames
where Company_Name Like @companyna + '%'
end


In above query please change table name to Column Name(Company_Name is table name in Where clause).
Write column name in which you want to perform search in where clause.

SQL
create proc spgetcompanynames
@companyna nvarchar(150)
as
begin
select Company_Name from companynames
where COLUMNAME  Like @companyna + &#39;%&#39;
end
 
Share this answer
 

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