如果数据库表名与关键字冲突怎么办?

hellopls 2003-05-06 03:14:07
在sql server2000里的northwind中有表格customer and suppliers by city
如果要对这个表格进行查询,写这样的语句
select * from customer and suppliers by city
是会报错的。
但是怎么样解决了?
...全文
348 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
hellopls 2003-05-07
  • 打赏
  • 举报
回复
改名字也是个好办法,不过我用的是动态的创建,所以。。。嘿嘿
谢了先
nboys 2003-05-06
  • 打赏
  • 举报
回复
exec master..sp_rename 'customer and suppliers by city','customer'
select * from northwind..customer
hellopls 2003-05-06
  • 打赏
  • 举报
回复
不过该怎么样给分了
后面的都和ldcr520是一样的答案
:(

明天给分
hellopls 2003-05-06
  • 打赏
  • 举报
回复
不过该怎么样给分了
后面的都和ldcr520是一样的答案
:(

明天给分
wbf420 2003-05-06
  • 打赏
  • 举报
回复
努力!朋友!
hellopls 2003-05-06
  • 打赏
  • 举报
回复

这种方法是对的select * from [customer and suppliers by city]
如果要数据库的话,可以是这样
select * from northwind..[customer and suppliers by city]

多谢大家了!!

miller3000 2003-05-06
  • 打赏
  • 举报
回复
select * from [Customer and Suppliers by City]
mjhnet 2003-05-06
  • 打赏
  • 举报
回复
select * from [customer and suppliers by city]
seasong 2003-05-06
  • 打赏
  • 举报
回复
select * from [customer and suppliers by city]
ldcr520 2003-05-06
  • 打赏
  • 举报
回复
select * from "customer and suppliers by city"
ldcr520 2003-05-06
  • 打赏
  • 举报
回复
select * from [customer and suppliers by city]
hellopls 2003-05-06
  • 打赏
  • 举报
回复
customer and suppliers by city是一个表格的名字,不信你可以去看一看
caiyunxia 2003-05-06
  • 打赏
  • 举报
回复
select * from table1,table2 where ...
hellopls 2003-05-06
  • 打赏
  • 举报
回复
在线等待

34,594

社区成员

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

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