一个自定义函数的问题。
接着问题:
http://expert.csdn.net/Expert/topic/1803/1803710.xml?temp=.9903681
函数如下:
CREATE FUNCTION GetMaxIDTemp (@tableName varchar(40),@tmp int)
RETURNS int
AS
begin
declare @MaxId bigint
declare @returnId bigint
declare @tmpId bigint
Select @MaxId = Max(id) from @tableName where substring(convert(nvarchar,id),1,1)= convert(varchar,@districtId)
return (@MaxId )
end
出现了
必须声明变量 '@tableName'。的错误
请教