SQL Packager 6

"Value cannot be null" error creating data script

When creating a new database package, SQL Packager may return the following error during the creation of the data script:

 "Value cannot be null. Parameter name: format"

Cause 

SQL Packager attempts to create a script to populate a new table, but if the table contains a column with a Binary Large Object (BLOB) datatype such as image or text, the scripting process fails because it has no index to use as the basis for the query to insert the BLOB data. If a unique index or primary key is created for the table, the scripting process will succeed.

How to fix

To work around this issue, therefore, you could create a primary key or unique index on the table, or exclude the table from the list of tables whose data you want to script.

 If more than one of these columns exists, you may identify it using the following (SQL Server 2005 and up) query:

SELECT NAME, object_id FROM sys.objects WHERE TYPE='U' AND OBJECT_ID IN (
SELECT object_id FROM sys.indexes WHERE TYPE = 0
AND OBJECT_ID NOT IN (SELECT object_id FROM sys.indexes WHERE TYPE <> 0 OR is_unique= 1))
and OBJECT_ID in (select OBJECT_ID from sys.columns where system_type_id in (35, 165, 99, 34, 173))

If you continue to experience problems, please contact Red Gate Support.


Didn't find what you were looking for?