Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
CREATE PROCEDURE getEmployeeInfo
AS
BEGIN
SELECT Emp_Name,
Designation FROM employee
ORDER BY Emp_Name;
END;

What I have tried:

why is this msg showing in sql sever?after i created table i write above sql query to stored procedure
Posted

Make sure that there is no SQL before the CREATE PROCEDURE statement, or if there is, it must be terminated by a GO statement, and that GO must be on a line by itself with no semicolon.

We can't see how you are executing that SQL code, so we can't do that for you!
 
Share this answer
 
What you posted is incomplete. The error is saying there are a LOT more lines to what you tried to execute than what you posted here. The error is on line 27, but you only posted 7 lines of SQL. Post the rest of what you have that includes this SQL.

I get the feeling you're using SQL Server Management Studio to manually create the database and its objects, but you don't know how it works. What you posted is only a single statement of many statements in the window and you're clicking the little Execute button. That button will execute EVERYTHING in the window, not just what you typed, UNLESS YOU FIRST HIGHLIGHT THE STATEMENT YOU WANT TO EXECUTE. Dragging and selecting only the statement you want to execute then clicking the Execute button will execute only what you highlighted.
 
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