比方说
CREATE PROCEDURE mysp_para
@CityName varchar(255),
@Short varchar(255)
AS
select * from AjaxCity where CityName=@CityName And Short=@Short
GO
AjaxCity可以用参数替换吗?
可以啊。参考这里: 存储过程 把表名作为参数。
create proc aa @a varchar(10) as begin declare @sql as varchar(100) set @a='a' set @sql='select * from '+@a ...
create proc mysp_para
@tableName varchar(20)
as
declare @mm varchar(20)
set @mm='select * from '+@tableName
exec(@mm)