Even though my below two table are identical , I am getting below error Error converting data type nvarchar to float.
while copying all data from one table to other , pls help where i am missing and how to correct the same
Table 1:
Table 2:
My query to copy the data :
insert into [Tool Management]([Type], [Material] ,[Material_Description] ,[Tool_Code] ,[Tool_Description] ,[Tool_Life])
select [Type], [Material] ,[Material_Description] ,[Tool_Code] ,[Tool_Description] ,[Tool_Life] from sheet1$
CodePudding user response:
If you want to move information from Table 1 to Table 2, the length of the "nvarchar" columns must be equal so that no error occurs.
INSERT INTO table2 ([type], [Material], [Material_Description], [Tool_Code], [Tool_Description], [Tool_Life])
SELECT
CAST([type] AS NVARCHAR(20))
,[Material]
,[Material_Description]
,CAST([Tool_Code] AS NVARCHAR(20))
,[Tool_Description]
,[Tool_Life]
FROM table1