MS SQL Server View not allowing CONCAT

后端 未结 2 1714
死守一世寂寞
死守一世寂寞 2021-01-27 07:46

MS SQL Server 2014.

I have a SQL statement that works fine:

SELECT CONCAT (
        CAST(T1.[F1] AS INTEGER),
        CAST(T1.[F2] AS INTEGER)
        )          


        
相关标签:
2条回答
  • 2021-01-27 08:11

    Please use concat function like below

    SELECT {fn CONCAT('123 ', '456') }

    0 讨论(0)
  • 2021-01-27 08:28

    Don't use the visual designers.

    They are buggy and in this case convert

        SELECT CONCAT (
            CAST(T1.[F1] AS INTEGER),
            CAST(T1.[F2] AS INTEGER)
            ) AS F3 
    FROM mytable AS T1
    

    to

    SELECT { fn CONCAT(CAST(T1.F1 AS INTEGER), CAST(T1.F2 AS INTEGER)) } AS F3
    FROM     mytable AS T1
    

    Calling the highly limited ODBC escape sequence version of the function (that only accepts two parameters which must be strings)

    Just use a standard new query window to execute your CREATE VIEW/ALTER VIEW/SELECT FROM operations and you won't get this issue.

    0 讨论(0)
提交回复
热议问题