主题:SQL声明问题
create proc existbyID
(
@strtableName varchar(255),
@strFielName varchar(255),
@intFieldVale int,
@bitResult bit OUTPUT
)
as
set nocount on
declare @strSQL varchar(3000)
declare @nCount int
if object_id('dbo.#tmptable') is null
create table #tmptable(tmpfield int)
else
truncate table #tmptable
select @strSQL='select count('[+@strFieldName+']) from ['+@strTableName+']
where['+@strFilelName+']=convert(varchar(50),@intFiledVale)
exec(@strSQL)
select TOP 1 @nCount=tmpField from #tmptable order by tmpfield
drop table @tmptable
if @nCount >0
select @bitResult=1
else
select @bitResult=0
go
上面提示strSQL 未声明。。请问要怎么声明啊。。
(
@strtableName varchar(255),
@strFielName varchar(255),
@intFieldVale int,
@bitResult bit OUTPUT
)
as
set nocount on
declare @strSQL varchar(3000)
declare @nCount int
if object_id('dbo.#tmptable') is null
create table #tmptable(tmpfield int)
else
truncate table #tmptable
select @strSQL='select count('[+@strFieldName+']) from ['+@strTableName+']
where['+@strFilelName+']=convert(varchar(50),@intFiledVale)
exec(@strSQL)
select TOP 1 @nCount=tmpField from #tmptable order by tmpfield
drop table @tmptable
if @nCount >0
select @bitResult=1
else
select @bitResult=0
go
上面提示strSQL 未声明。。请问要怎么声明啊。。