How to safely use reserved SQL names?

前端 未结 3 1173
半阙折子戏
半阙折子戏 2020-11-29 13:50

I\'m using Cakephp 3 using sqlserver as datasource server. I am sure there\'s no problem with my database connection.. as home.ctp prompts that I am connected to my database

3条回答
  •  旧巷少年郎
    2020-11-29 14:43

    Use this :

    SELECT * FROM (SELECT Tests.id AS [Tests__id], Tests.[desc] AS [Tests__desc], 
    (ROW_NUMBER() OVER (ORDER BY (SELECT NULL))) AS [_cake_page_rownum_] FROM tests Tests) _cake_paging_
    WHERE _cake_paging_._cake_page_rownum_ <= :c0
    

    If you do use a keyword, use it in square braces [ ]

提交回复
热议问题