现有代码declare @value varchar(8000) set @value='' select @value=@value +A0605 +',' from A06 where A0601 in ('88','77') order by id
在ASP中,我如何能得到@value的值?(我是把以上的代码在ASP中执行),急急急!谢谢!
...全文
14613打赏收藏
SQL语句执行问题,请大哥们帮忙呀!
现有代码declare @value varchar(8000) set @value='' select @value=@value +A0605 +',' from A06 where A0601 in ('88','77') order by id 在ASP中,我如何能得到@value的值?(我是把以上的代码在ASP中执行),急急急!谢谢!
不好意思,我忘记了把解决的方法贴出来了。代码如下:
sQuery="exec('declare @value varchar(8000) set @value=''''"
sQuery=sQuery & " select @value=@value +D1902 +'','' from D19 where D1901 in (''" & replace(m_value,",","'',''") & "'') order by id "
sQuery=sQuery & " select @value as value ')"
set rs=conn.execute(sQuery)
If not rs.eof Then
m_value=dealNull(rs("value"))
End If
if m_value<>"" then m_value=left(m_value,len(m_value)-1)
这是在ASP中的代码,呵呵,很简单吧,执行速度快,而且不需要使用存储过程。当一个SQL语句来执行,这样吧,分数人人都有,平均分吧。希望各位大哥以后多多支持!
我说的是在ASP中如何得到?我在后面加了一条语句:select @value as value,但是在ASP中conn.execute(sQuery)(0),竟然取不到值.
sQuery="declare @value varchar(8000) set @value=''"
sQuery=sQuery & " select @value=@value +A0605 +',' from A06 order by id "
sQuery=sQuery & " select @value as value".
在查询分析器中能显示出@value的值,但是在ASP中取不到,请问如何?