Friday, March 9, 2012
import data and get unique id
Example:CREATE TABLE new_employees
(
id_num int IDENTITY(1,1),
fname varchar (20),
minit char(1),
lname varchar(30)
)
See Books online for more info.|||I did that but I still get an error saying that column cannot contain a null value when I import the data for the other column out of a text file (csv).|||I can offer a different perspective,
You just have to disable the 'enable identity insert' checkbox when you are doing your import.|||That worked perfectly, Thank you so much.
Import CSV Files to SQL Server Null Values Problem
Hello,
I am trying to import a CSV file into my SQL Server database, this file was originally generated by another database table (on another server) with the same structure, the table contains two columns ofrealdatatype withAllow Null Valuesetto true for those columns, the CSV file contains the valueNULLfor theses columns, I am facing a problem when importing this file. This may be because DTS tries to represent values as strings then to convert them torealdatatype which results in transforming the value "NULL" toreal,I receive an error message saying.
Error during Transformation 'DirectCopyXform' for Row number 1. Errors encountered so far in this task: 1.
TransformCopy 'DirectCopyXform' conversion error: Conversion invalid for datatypes on column pair 8 (source column 'Col008' (DBTYPE_STR), destination column 'zip_longitude' (DBTYPE_R4)).
TransformCopy 'DirectCopyXform' conversion error: Conversion invalid for datatypes on column pair 7 (source column 'Col007' (DBTYPE_STR), destination column 'zip_latitude' (DBTYPE_R4)).
How can I work around this problem?
Any help would be appreciable
Did you get a solution? I have the same issue.... Please let me know at the earliest...
Sunday, February 19, 2012
Implicit conversion from datatype nvarchar to varbinary(MAX)
I am runnning SQL Server 2005...one of my columns is set to Varbinary(MAX), but when I try and set it to null, I get this error, when calling a stored procedure from C#.
'Implicit conversion from datatype nvarchar to varbinary(MAX) is not allowed. Use the CONVERT function to run this query.'
Thanks
Murph
are you sure you are passing null and not 'null' ?
take a look at this
--good
declare @.v Varbinary(MAX)
select @.v = null
select @.v
go
--bad, will fail
declare @.v Varbinary(MAX)
select @.v = 'null'
select @.v
go
Denis the SQL Menace
http://sqlservercode.blogspot.com/
check your parameter datatype on your C# Code..