I have a table in 2 different database.
In Database_A, there is a table created as:
CREATE TABLE tbl_Employee(
E_Id int null
,E_Name varchar(24) not null
,Joining_Date datetime not null
)
In Database_B, the same table is created as:
CREATE TABLE tbl_Employee(
E_Id int null
,E_Name varchar(24) not null
,Joining_Date datetime null
)
The difference is, the column Joining_Date is NOT NULL in Database_A but it allows NULL in the Database_B.
Now when I export data from the table Database_A.dbo.tbl_Employee
using command
bcp "select * from Database_A.dbo.tbl_Employee" queryout "D:\test.txt" -S Server_Name -n -T
and import into Database_B.dbo.tbl_Employee
using command
bcp "Database_B.dbo.tbl_Employee2" in "D:\test.txt"-S Server_Name -n -T
It raises an Error:
SQLState = S1000, NativeError = 0 Error = [Microsoft][SQL Server Native Client 11.0]Unexpected EOF encountered in BCP data-file
I can not alter the column to NOT NULL on Database_B