declare @stu varchar(50)
select
case when stname!=''
then
set @stu=stname,
stname
end from stu s,stname sn from s.st_id=sn.st_id
这样写为什么有错误,我想要的是让@stu变量能够获取到case when中获取stname的值。谢谢给为大哥了。帮帮吗?如果不行请问有什么别的办法请多多指教!!
select
case when stname!=''
then
set @stu=stname,
stname
end from stu s,stname sn from s.st_id=sn.st_id
这样写为什么有错误,我想要的是让@stu变量能够获取到case when中获取stname的值。谢谢给为大哥了。帮帮吗?如果不行请问有什么别的办法请多多指教!!
解决方案 »
- C#写的关于SQL数据库问题
- 没看明白这句报错的意思
- SQL语句运行错误,帮忙看一下!
- 怎样改变这个表的所有者
- 查询问题。
- 如果在SQL中需要访问另一个数据库,用openrowset如何写????
- Subqueries are not allowed in this context. Only scalar expressions are allowed.
- 在存储过程中使用exec("select * from tableA ") 效率怎么样?
- 请作一次系统分析员
- Oracle能下载吗?下载的oracle8i与付费oracle有区别吗?
- 数据库 当既能用连接词查询又能用嵌套查询时,应该选择哪种查询较好
- sql2000的作业为何一直不自动运行?
case when stname<>''
then
stname
end from stu s,stname sn from s.st_id=sn.st_id select @stu =
(case when stname<>''
then
stname
end) from stu s,stname sn from s.st_id=sn.st_id
from stu as a where st_id=1
@stu=case when stname!='' then stname else 0 end
from
stu s
where
st_id=1
select
(@stu=case when stname!='' then stname else 0 end )
from
stu s,stname sn
where
s.st_id=sn.st_id
在语句的第四行多了个stname
declare @str varchar(50)
select @str =
case when stname != '' then stname end
from stu s,stname sn
where s.st_id = sn.st_id