SQL 超链接 - SSMS 返回多个错误
SQL hyperlink - SSMS comes back with multiple errors
我是 SQL 的新手,我在家自学。我一直在家里学习教程,与此同时,我也在尝试发挥创意。我正在尝试 link 一个 hyperlink,但我一直收到错误消息。
以下是我在之前关于 Stack Overflow 的评论中找到的代码:
Medicalrecord Select CAST('https://www.google.com' as XML)
我们的想法是创建一个图表,其中包含一个名为“医疗记录”的列,并对其进行 hyperlinked pdf。
请在下面找到完整代码:
Create Table MedicalFiles
(
PatientName varchar(50),
DoctorName varchar(50),
DoctorSpecialy varchar(50),
reasonforthevisit varchar(50),
doctorvisitcost int,
medicationcost int,
additionalcostsdescription varchar(50),
Additionalcostvalue int,
Medicalrecord Select CAST('https://www.google.com' as XML)
)
这是我遇到的错误:
Msg 173, Level 15, State 13, Line 11 The definition for column
'Medicalrecord' must include a data type.
Msg 102, Level 15, State 1, Line 12 Incorrect syntax near ')'.
CREATE TABLE
syntax 不允许对计算列定义进行 SELECT
查询。下面的 DDL 将创建一个带有 XML 常量的计算列,因此它可以在 SELECT 查询中使用:
CREATE TABLE dbo.MedicalFiles
(
PatientName varchar(50),
DoctorName varchar(50),
DoctorSpecialy varchar(50),
reasonforthevisit varchar(50),
doctorvisitcost int,
medicationcost int,
additionalcostsdescription varchar(50),
Additionalcostvalue int,
Medicalrecord AS CAST('https://www.google.com' as XML)
);
我是 SQL 的新手,我在家自学。我一直在家里学习教程,与此同时,我也在尝试发挥创意。我正在尝试 link 一个 hyperlink,但我一直收到错误消息。
以下是我在之前关于 Stack Overflow 的评论中找到的代码:
Medicalrecord Select CAST('https://www.google.com' as XML)
我们的想法是创建一个图表,其中包含一个名为“医疗记录”的列,并对其进行 hyperlinked pdf。
请在下面找到完整代码:
Create Table MedicalFiles
(
PatientName varchar(50),
DoctorName varchar(50),
DoctorSpecialy varchar(50),
reasonforthevisit varchar(50),
doctorvisitcost int,
medicationcost int,
additionalcostsdescription varchar(50),
Additionalcostvalue int,
Medicalrecord Select CAST('https://www.google.com' as XML)
)
这是我遇到的错误:
Msg 173, Level 15, State 13, Line 11 The definition for column 'Medicalrecord' must include a data type.
Msg 102, Level 15, State 1, Line 12 Incorrect syntax near ')'.
CREATE TABLE
syntax 不允许对计算列定义进行 SELECT
查询。下面的 DDL 将创建一个带有 XML 常量的计算列,因此它可以在 SELECT 查询中使用:
CREATE TABLE dbo.MedicalFiles
(
PatientName varchar(50),
DoctorName varchar(50),
DoctorSpecialy varchar(50),
reasonforthevisit varchar(50),
doctorvisitcost int,
medicationcost int,
additionalcostsdescription varchar(50),
Additionalcostvalue int,
Medicalrecord AS CAST('https://www.google.com' as XML)
);