I am trying to move all the data from one column in an Excel sheet into a SQL Server database table using SQL Server Management Studio. The data in the table covers different OS versions by year, and some of them contain letters, such as 2008R2
.
When I tried to move the data into the table, I get an error saying that Null types are not allowed in that column. But when I changed the column to allow Null types, anything that contained a letter or a non-numeric character was designated as Null. The attribute in question is stored in its original table as a float
, but I want it to be varchar
in my table.
I ran a basic T-SQL INSERT INTO
command like this:
INSERT INTO Instance
SELECT Version, OS, SpotPrice, ContractPrice
FROM dbo.Data$;
All numeric entries were put into the table, and entries containing non-numeric characters were input as Null.
Robert is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1