怎样创建临时表 sql server数据库

wangfeixue 2002-09-02 12:50:25
我想建一个临时表,结构为

bh(int, 4)
str(char,10)
money(float,8)

怎样建这个临时表。
又怎样在form里用。和用其它物理上的表是一样的用法吗?

如果创建了一个临时表, 第二个用户在查询的时候也创建这个临时表,数据是不是会有误。




...全文
146 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
利而不害 2002-09-02
  • 打赏
  • 举报
回复
这个sql语句很多毛病
1. order by password,OrderType
order by 后面的字段名不能用别名的,要用原来的字段名。而你的OrderType是 2 的别名。
2. A.password,'采购进货' as type
这个句话我都不懂是什么意思,你要让字段password的别名是'采购进货'还是type?应该是a.password as type
3. 在你的语句中有C.gysname ,B.ze 等字段,可是你并没有声明表b和表c叫什么名字
4. 2 as OrderType这个2到底是什么东西,我想只有你自己知道了
wangfeixue 2002-09-02
  • 打赏
  • 举报
回复
select * into #temp from
(
select type as 类型,gysname as 供应商名称,jhdh as 单号,ze as 总额,xmoney as 进项税额,zexmoney as 价税合计
from
(
select A.password,'采购进货' as type,C.gysname As gysname,A.jhdh,B.ze as ze,B.xmoney as xmoney,B.zexmoney as zexmoney, 2 as OrderType
From jhdb A,

order by password,OrderType
))


//Server: Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'order'.
这是什么错误

10,611

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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