create proc pro_updateSimple
@content text,
@cshort char(4),
@kind varchar(20)
as
declare @sql text
select @sql='update tbUp188_SimpleSet set '+@kind+'='''+@content+''' where SSCShort='''+@cshort+''''
exec(@sql)
go
本来是:exec('update tbUp188_SimpleSet set '+@kind+'='''+@content+''' where SSCShort='''+@cshort+'''')没错。但是想换成上面那种写法,但是出错了:对于局部变量,text、ntext 和 image 数据类型无效。求解。谢谢。搞定立马结贴。。
@content text,
@cshort char(4),
@kind varchar(20)
as
declare @sql varchar(8000)
select @sql='update tbUp188_SimpleSet set '+@kind+'='''+@content+''' where SSCShort='''+@cshort+''''
exec(@sql)
go
@content text,
@cshort char(4),
@kind varchar(20)
as
declare @sql text
select @sql='update tbUp188_SimpleSet set '+@kind+'='''+cast(@content as varchar)+''' where SSCShort='''+@cshort+''''
exec(@sql)
go
@content text,
@cshort char(4),
@kind varchar(20)
as
declare @sql varchar(8000)
select @sql='update tbUp188_SimpleSet set '+@kind+'='''+@content+''' where SSCShort='''+@cshort+''''
exec(@sql)
go
@content text,
@cshort char(4),
@kind varchar(20)
as
declare @sql as varchar(8000)
select @sql='update tbUp188_SimpleSet set '+@kind+'='''+cast(@content as varchar)+''' where SSCShort='''+@cshort+''''
exec(@sql)
go
@content varchar(max),
@cshort char(4),
@kind varchar(20)
as
declare @sql varchar(max)
select @sql='update tbUp188_SimpleSet set '+@kind+'='''+@content+''' where SSCShort='''+@cshort+''''
print(@sql)
go
create proc pro_updateSimple
@content text,
@cshort char(4),
@kind varchar(20)
as
declare @sql text
select @sql='update tbUp188_SimpleSet set '+@kind+'='''+cast(@content as varchar(8000))+''' where SSCShort='''+@cshort+''''
exec(@sql)
go
@content text,
@cshort char(4),
@kind varchar(20)
as
declare @sql varchar(8000)
select @sql='update tbUp188_SimpleSet set '+@kind+'='''+cast(@content as varchar(8000))+''' where SSCShort='''+@cshort+''''
exec(@sql)
create proc pro_updateSimple
@content text,
@cshort char(4),
@kind varchar(20)
as
declare @sql varchar(8000)
select @sql='update tbUp188_SimpleSet set '+@kind+'='''+cast(@content as varchar(8000))+''' where SSCShort='''+@cshort+''''
exec(@sql)
go
@content text,
@cshort char(4),
@kind varchar(20)
as
declare @sql varchar(8000)
select @sql='update tbUp188_SimpleSet set '+@kind+'='''+cast(@content as varchar(8000))+''' where SSCShort='''+@cshort+''''
exec(@sql)
go