Sql server 将(sql)数据类型varchar转换为浮点时出错。。。但没有什么是浮动的
我有一个存储过程,在这个存储过程中,源、目标和将内容连接到源的列都没有数据类型float。但当我尝试运行它时,我会 将数据类型varchar转换为float时出错 我浏览了源代码中引用的每一列,并对其进行了注释,试图找出它试图转换的内容,但它似乎总是给出相同的消息 据我所知,我的列都是Sql server 将(sql)数据类型varchar转换为浮点时出错。。。但没有什么是浮动的,sql-server,Sql Server,我有一个存储过程,在这个存储过程中,源、目标和将内容连接到源的列都没有数据类型float。但当我尝试运行它时,我会 将数据类型varchar转换为float时出错 我浏览了源代码中引用的每一列,并对其进行了注释,试图找出它试图转换的内容,但它似乎总是给出相同的消息 据我所知,我的列都是varchar(255)或int with temp_mart as ( select ca.YearMonth as Date, s.ID as SurveyID, t.Team
varchar(255)
或int
with temp_mart as (
select
ca.YearMonth as Date,
s.ID as SurveyID,
t.TeamName as Team,
q.MetricID,
-- cast(C.City as varchar(255)) as City,
r.Role,
QR.QuestionID,
QR.ID as QuestionResponseID,
QR.Rating,
QR.OpenResponse,
QT.ID as QuestionTypeID
from QuestionResponses QR
join lkup.Questions Q on Q.QuestionID=QR.QuestionID
join lkup.Teams T on t.id=Q.TeamID
join lkup.Surveys S on s.id=q.SurveyID
join lkup.Calendar ca on ca.id=s.ValidFromID
join Responses RE on RE.Qualtrics_ID=QR.Qualtrics_ID
join lkup.Roles R on r.id=re.roleID
join lkup.Cities C on c.id=re.cityID
join lkup.QuestionType QT on QT.ID=Q.QuestionTypeID
where (select count(cityid) from responses) > 3
)
merge DataMart as target
using temp_mart as source
on (source.QuestionResponseID = target.QuestionResponseID)
when matched then update
set
target.Rating=source.Rating,
target.OpenResponse=source.OpenResponse
when not matched by target
then insert (
Date,
SurveyID,
Team,
MetricID,
-- City
Role,
QuestionID,
QuestionResponseID,
Rating,
OpenResponse,
QuestionTypeID)
values (
source.Date,
source.SurveyID,
source.Team,
source.MetricID,
--source.City,
source.Role,
source.QuestionID,
source.QuestionResponseID,
source.Rating,
source.OpenResponse,
source.QuestionTypeID)
你有什么意见吗?视图的源表可能是错误的原因。它们都是表。。