doudizhi947129
2013-04-16 20:01
浏览 452

关于PHP SQL查询的案例与MySQL数据库上的案例不同。 不能使用lower_case_table_names = 1

I'm having an issue with a website I wrote in PHP on a WAMP server on Windows, issue is, it's now being deployed on a Linux server. The site is quite big and I've done all my queries this way in all caps:

"SELECT COLUMN FROM TABLE"

And most of the tables/columns in the database use a different case (For example, Column).

I cannot use lower_case_table_name=1 since there are other PHP websites on the server that would be affected negatively. Is there a way for me to switch all of my database's tables and columns into upper case?

图片转代码服务由CSDN问答提供 功能建议

我在Windows上的WAMP服务器上用PHP编写的网站存在问题,问题是,它是 现在部署在Linux服务器上。 该网站非常庞大,我以所有方式完成了所有查询:

 “SELECT COLUMN FROM TABLE”
   \  n 
 

数据库中的大多数表/列使用不同的大小写(例如,Column)。

我不能使用 lower_case_table_name = 1 因为服务器上还有其他PHP网站会受到负面影响。 有没有办法让我将所有数据库的表和列切换成大写?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanlang1196 2013-04-16 20:12
    已采纳

    you have change the names of columns and tables if you database is not so huge you can try this

    select concat('rename table ', column_name, ' to ' , lower(column_name) , ';') 
    from information_schema.columns where table_schema = 'your_schema_name';
    

    and rename or change the case for more help see and lower_case_table_names

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • duanguanzai6181 2013-04-16 20:03

    ALTER TABLE yourtablename RENAME TO YOURTABLENAME;

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题