sql2000使用变量做表名的查询
declare @dianxin decimal(7,2),
@hipath decimal(7,2),
@xishu decimal(7,3)
declare @biao char(10)
set @biao='bill200903'
select @dianxin=je
from huizhong
where yf='2009-03'
and phone='86224888'
select @hipath=sum(charge)
from @biao
set @xishu=@dianxin/@hipath
print @xishu
if object_id('temp_1') is not null drop table temp_1
select phone,@xishu*sum(case when price=0.3 then charge else 0 end) changtu,@xishu*sum(case when price<>0.3 then charge else 0 end) shihua
from @biao
出错提示:
服务器: 消息 137,级别 15,状态 2,行 16
必须声明变量 '@biao'。
服务器: 消息 137,级别 15,状态 1,行 22
必须声明变量 '@biao'。
@hipath decimal(7,2),
@xishu decimal(7,3)
declare @biao char(10)
set @biao='bill200903'
select @dianxin=je
from huizhong
where yf='2009-03'
and phone='86224888'
select @hipath=sum(charge)
from @biao
set @xishu=@dianxin/@hipath
print @xishu
if object_id('temp_1') is not null drop table temp_1
select phone,@xishu*sum(case when price=0.3 then charge else 0 end) changtu,@xishu*sum(case when price<>0.3 then charge else 0 end) shihua
from @biao
出错提示:
服务器: 消息 137,级别 15,状态 2,行 16
必须声明变量 '@biao'。
服务器: 消息 137,级别 15,状态 1,行 22
必须声明变量 '@biao'。
...全文
相关推荐
oracle输入表名获取所有表字段脚本
- `v_sql varchar2(2000);` - `v_sql`:用于构建最终的SQL查询语句的变量。#### 2.
Microsoft SQL Server 2000 技巧.doc
+@cs```这里展示了如何更新表`Table1`中`zd1`列的值,通过`@tbname`变量动态指定表名,`@cs`变量则用来增加`zd1`列的值。
在Developer_2000编程中实现动态SQL语句调用的研究.pdf
然而,在Oracle的Developer/2000开发工具中,不能直接使用这种动态SQL机制,因为Developer/2000的ForillBuilder不允许将表名、字段名等作为参数传递给SQL语句,
sql2000分页存储过程
本存储过程`P_viewPage_A`设计用于实现高效、通用的分页查询功能,适用于具有单一主键或唯一值列的表或视图。存储过程的关键参数包括:1. `@TableName`: 指定需要查询的表名。2.
非常全面的SQL2000学习资料
首先,SQL语言是SQL2000的基础,它起源于IBM公司的研发,通常称为结构化查询语言,用于对数据库进行查询、更新和管理。


