create procedure test
BEGIN
select *
from User
END
;
有人能告诉我这有什么问题吗?你能告诉我一个简单的创建过程吗?
输入“在 sql server 中创建过程”后,谷歌上的第一个链接给出了您的答案。看看这个:-
CREATE { PROC | PROCEDURE } [schema_name.] procedure_name [ ; number ]
[ { @parameter [ type_schema_name. ] data_type }
[ VARYING ] [ = default ] [ OUT | OUTPUT | [READONLY]
] [ ,...n ]
[ WITH <procedure_option> [ ,...n ] ]
[ FOR REPLICATION ]
AS { [ BEGIN ] sql_statement [;] [ ...n ] [ END ] }
[;]
<procedure_option> ::=
[ ENCRYPTION ]
[ RECOMPILE ]
[ EXECUTE AS Clause ]
如果您使用的是 SQL Server,那么您只是错过了AS
:
create procedure test
as
BEGIN
select *
from User
END
DELIMITER $$
CREATE PROCEDURE `test`()
BEGIN
SELECT * FROM USER;
END$$
DELIMITER ;
编辑:这是为Mysql ..
在 SQL Server 中使用参数创建过程 单击此处 sqltutorialspoint