本文介绍了将nvarchar值''转换为数据类型int时转换失败。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! i我得到了这个错误如何解决它。 转换时转换失败nvarchar值'test Maths'到数据类型int。 我的查询是: 插入 进入 CR_Modules_Test(CRModule_Name,CRModule_LevelId,CRModule_RefCourseId,CRModule_RefCourseName,CRModule_ModuleName) 选择 CRLevel_Name,CRLevelID,Course_Name,( SELECT (COUNT( DISTINCT CRLevel_CourseId)* 10 + 1) CRModule_RefCourseId FROM CR_Modules inner JOIN CR_Levels ON CRModule_LevelId = CRLevelID) as ' CRModule_RefCourseId',CRLevel_Name 来自 CR_Levels 内部 join 课程 CourseID = CRLevel_CourseId 其中 CourseID = 5273 和 CRLevel_LevelDepth = 2 谢谢, Karthikeyan。解决方案 找出错误的技巧...... 获取您要更新的列列表并将它们放入一列 CRModule_Name CRModule_LevelId CRModule_RefCourseId CRModule_RefCourseName CRModule_ModuleName 现在取你试图插入的值将按顺序与列名称匹配,您将获得此 CRModule_Name = CRL evel_Name CRModule_LevelId = CRLevelID CRModule_RefCourseId = Course_Name CRModule_RefCourseName = CRModule_RefCourseId CRModule_ModuleName = CRLevel_Name 我突出了你的问题。 解决这个问题最简单的方法就是改变列表中列的顺序 插入 进入 CR_Modules_Test(CRModule_Name,CRModule_LevelId, CRModule_RefCourseName,CRModule_RefCourseId ,CRModule_ModuleName) Hi, i am got this error how to solved it.Conversion failed when converting the nvarchar value 'test Maths' to data type int.my query is:insert into CR_Modules_Test(CRModule_Name,CRModule_LevelId,CRModule_RefCourseId,CRModule_RefCourseName,CRModule_ModuleName)select CRLevel_Name,CRLevelID,Course_Name,(SELECT (COUNT( DISTINCT CRLevel_CourseId )*10+1) as CRModule_RefCourseId FROM CR_Modulesinner JOIN CR_Levels ON CRModule_LevelId =CRLevelID)as 'CRModule_RefCourseId',CRLevel_Name from CR_Levelsinner join Course on CourseID=CRLevel_CourseIdwhere CourseID=5273 and CRLevel_LevelDepth=2Thanks,Karthikeyan. 解决方案 A technique for finding out what is wrong ...Take the list of columns you are trying to update and put them into a single columnCRModule_NameCRModule_LevelIdCRModule_RefCourseIdCRModule_RefCourseNameCRModule_ModuleNameNow take the values you are trying to insert and match them up in order with the column names, and you will get this CRModule_Name = CRLevel_NameCRModule_LevelId = CRLevelIDCRModule_RefCourseId = Course_NameCRModule_RefCourseName = CRModule_RefCourseIdCRModule_ModuleName = CRLevel_NameI've highlighted your problem.The easiest way to fix this is to just change the order of the columns in the listinsert into CR_Modules_Test(CRModule_Name,CRModule_LevelId,CRModule_RefCourseName,CRModule_RefCourseId,CRModule_ModuleName) 这篇关于将nvarchar值''转换为数据类型int时转换失败。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-30 05:50