Copy from one database to another database table in sql server 2008 R2 Error!!!!!

When i am trying to Copy data from one database to another database table of Same Sql instance getting the error.

i am using Nav 2013 Databases.

SQL error:
Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into column ‘Name’, table ‘NEWDB.dbo.UCC$CustDB2’; column does not allow nulls. INSERT fails.
The statement has been terminated.

Query for the above error

Insert into NewDB.dbo.UCC$CustDB2(No,Address)
select OLDDB.dbo.[Nav7 Demo$CustDB1].No,OLDDB.dbo.[Nav7 Demo$CustDB1].Address from OLDDB.dbo.[Nav7 Demo$CustDB1]
Where OLDDB.dbo.[Nav7 Demo$CustDB1].No not in (select NewDB.dbo.UCC$CustDB2.No from NewDB.dbo.UCC$CustDB2 )

Well, if you want to copy a complete database I’d rather simply restore a backup file of the source-db as a new db …

If you just transfer data via INSERT INTO … SELECT FROM … you must be aware that NAV tables only accept values not-NULL; hence, you must provide every field of that table!

Or you enable the “Maintain Defaults” option in the target-database.

Thank you…


Can we create a New customer by above query by validating New No.series using sql query.

I mean to say when ever new customer is created a No should be generated…

can you please share the sample query…

Thank you.

ex: using NoSeriesMgt.GetNextNo in Sql query