Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 bulkinsert and keepnulls

Author  Topic 

magmo
Aged Yak Warrior

558 Posts

Posted - 2007-03-27 : 02:42:05
Hi

I have some trouble with a stored procedure that I could use some help with. My sp look like this...


p_BulkInsertPD
(@PData ntext)
AS
DECLARE @hDoc int
exec sp_xml_preparedocument @hDoc OUTPUT,@PData

SET NOCOUNT ON;

INSERT INTO tbl_PD_Answers(NodeID, AprovalID, FaultID, Grade, MeasureID, ProtocolID)
--(KEEPNULLS)
SELECT *
FROM OPENXML(@hDoc, 'ROOT/PROT/PD',1)
WITH ( NID Integer , AID Integer , FID Integer , GID integer, MID integer, PID integer ) XMLEmp

EXEC sp_xml_removedocument @hDoc


The procedure itself works, but it doesnt work when I pass on empty values in a column that expect a integer, then I get a error on my aspx page that says "Conversion failed when converting the nvarchar value 'NULL' to data type int."

Do I need to add a keppnulls to my sp? In that case where do I do that? Sorry if this turn out to be a .net problem, but I don't know where to start.


Regards
   

- Advertisement -