这样赋值不行么?

zmy_817 2010-05-24 05:12:04


---@tp_title 是传过来的参数 是nvarcahr
declare @docs nvarchar(255)

select @docs=tp_Fields from @tp_title where tp_title='GCard_BU';

这样赋值 不行么?
...全文
78 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
feixianxxx 2010-05-24
  • 打赏
  • 举报
回复
declare @s nvarchar(4000),@docs nvarchar(255)
set @s='select @d=tp_Fields from '+@tp_title+' where tp_title=''GCard_BU'''

exec sp_executesql @s,N'@d varchar(100) output',@docs output
select @docs
a_Spring 2010-05-24
  • 打赏
  • 举报
回复

select @date1=max(CHNG_DATE) from CFP_NETVAL where CFP_ID=@CFPID and CHNG_DATE<date2 and ISVALID='1';--取出此日期的上一个值

完全可以啊 我就这样赋值的没出问题
永生天地 2010-05-24
  • 打赏
  • 举报
回复

declare @docs nvarchar(255)

exec sp_executesql N'select @docs=tp_Fields from @tp_title where tp_title=''GCard_BU''',N'@docs nvarchar(255) output',@docs output
oyctzl 2010-05-24
  • 打赏
  • 举报
回复
declare @docs nvarchar(255)

set @docs=tp_Fields from @tp_title where tp_title='GCard_BU';

select 改为set

PxxxP 2010-05-24
  • 打赏
  • 举报
回复
declare @docs nvarchar(255)
set @docs=''
select @docs=tp_Fields from @tp_title where tp_title='GCard_BU';

34,594

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧