简单的问题我似乎无法找到一个简单的答案。为什么,在MSSQL中,我无法创建一个" "和" CONSTANT_TEXT_VALUE"在下面的视图中的列?应该有办法做到这一点吗?
CREATE VIEW TEST_VIEW AS
SELECT DEPT,
SALES,
"" AS BLANK_COLUMN,
"Some Text" AS CONSTANT_TEXT_VALUE
FROM SOME_TABLE
答案 0 :(得分:5)
SQL Server中的文本分隔符遵循ANSI标准。这是一个单引号:
CREATE VIEW TEST_VIEW AS
SELECT DEPT, SALES,
'' AS BLANK_COLUMN, 'Some Text' AS CONSTANT_TEXT_VALUE
FROM SOME_TABLE;
答案 1 :(得分:5)
使用single quote
s。
CREATE VIEW TEST_VIEW AS
SELECT DEPT,
SALES,
' ' AS BLANK_COLUMN,
'Some Text' AS CONSTANT_TEXT_VALUE
FROM SOME_TABLE