I want to insert those values also which have version null and and for version null I don't have status.
I am getting all data from datatable to procedure table type and then how do I check that the incoming data has version null or not?
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[uspInsertFilterData]
@sqlDataTable SqlTableType READONLY
AS
BEGIN
IF (@sqlDataTable.Version IS NOT NULL OR @sqlDataTable.Version != '')
BEGIN
INSERT INTO FilterCombination (Version, HotFix, Resourcetype, Language)
(SELECT
t1.Product, t1.Version, t1.HotFix, t1.Resourcetype,
t1.Language
FROM
@sqlDataTable t1, Product_Version_Mapping t2
WHERE
t1.Product = t2.Product
AND t1.Version = t2.Version
AND t2.Status = 'Correct')
END
ELSE
BEGIN
INSERT INTO FilterCombination (Product, Version, HotFix, Resourcetype, Language)
(SELECT
t1.Product, t1.Version, t1.HotFix, t1.Resourcetype, t1.Language
FROM
@sqlDataTable t1, Product_Version_Mapping t2
WHERE
t1.Product = t2.Product);
END
END
This query is not working. Please help