I use SQL Server Management Studio 2012. When I try to create a stored procedure and I execute it, it returns an error every time. I really can not figure out whats wrong.
For example:
use AdventureWorks2012
CREATE PROCEDURE test () SELECT * FROM [Sales].[SalesPerson]
and the error is :
Msg 102, Level 15, State 1, Procedure test, Line 1
Incorrect syntax near ‘)’.
even If I just write CREATE PROCEDURE TEST
It will return error ? What am I doing wrong ?
Try this code:
You have to remove
()if your procedure does not need parameters, and addas, optionallybegin-end(it’s more usable).If you want to add parameters to your procedure in future: