October 18, 2005 at 8:41 am
Hi,
I might be too tired to figure this out but I’m currently facing a problem with SQL Server 2005 September CTP.
Using the following statement:
UPDATE DW.dbo.DIMPromotion
SET DescriptionPromotion = b.DescriptionPromotion
,DescriptionCirculaire = b.DescriptionCirculaire
,DescriptionCarreau = b.DescriptionCarreau
,CodeImpact = b.CodeImpact
,DescriptionImpact = b.DescriptionImpact
,CodePromotionLiee = b.CodePromotionLiee
,StatutPromotion = b.StatutPromotion
,DateDebutPromotion = b.DateDebutPromotion
,DateFinPromotion = b.DateFinPromotion
,DateDebutMagasin = b.DateDebutMagasin
,DateFinMagasin = b.DateFinMagasin
,MontantFixe = b.MontantFixe
,VolumeProjete = b.VolumeProjete
FROM DW.dbo.DIMPromotion a
JOIN #DimPromotion b ON b.CodePromotion = a.CodePromotion
AND b.CodeCirculaire = a.CodeCirculaire
AND b.CodeCarreau = a.CodeCarreau
AND b.NumeroContrat = a.NumeroContrat
AND
(
b.DescriptionPromotion <> a.DescriptionPromotion
OR b.DescriptionCirculaire <> a.DescriptionCirculaire
OR b.DescriptionCarreau <> a.DescriptionCarreau
OR b.CodeImpact <> a.CodeImpact
OR b.DescriptionImpact <> a.DescriptionImpact
OR b.CodePromotionLiee <> a.CodePromotionLiee
OR b.StatutPromotion <> a.StatutPromotion
OR b.DateDebutPromotion <> a.DateDebutPromotion
OR b.DateFinPromotion <> a.DateFinPromotion
OR b.DateDebutMagasin <> a.DateDebutMagasin
OR b.DateFinMagasin <> a.DateFinMagasin
OR b.MontantFixe <> a.MontantFixe
OR b.VolumeProjete <> a.VolumeProjete
)
I Receive the following error message:
Msg 8114, Level 16, State 5, Line 1
Error converting data type nvarchar to numeric.
The weird part is if a comment a few lines (never the same) the statement works properly without generating en error message…
The following statement are working properly :
UPDATE DW.dbo.DIMPromotion
SET DescriptionPromotion = b.DescriptionPromotion
,DescriptionCirculaire = b.DescriptionCirculaire
,DescriptionCarreau = b.DescriptionCarreau
,CodeImpact = b.CodeImpact
,DescriptionImpact = b.DescriptionImpact
,CodePromotionLiee = b.CodePromotionLiee
,StatutPromotion = b.StatutPromotion
,DateDebutPromotion = b.DateDebutPromotion
,DateFinPromotion = b.DateFinPromotion
,DateDebutMagasin = b.DateDebutMagasin
,DateFinMagasin = b.DateFinMagasin
,MontantFixe = b.MontantFixe
,VolumeProjete = b.VolumeProjete
FROM DW.dbo.DIMPromotion a
JOIN #DimPromotion b ON b.CodePromotion = a.CodePromotion
AND b.CodeCirculaire = a.CodeCirculaire
AND b.CodeCarreau = a.CodeCarreau
-- AND b.NumeroContrat = a.NumeroContrat
AND
(
b.DescriptionPromotion <> a.DescriptionPromotion
-- OR b.DescriptionCirculaire <> a.DescriptionCirculaire
-- OR b.DescriptionCarreau <> a.DescriptionCarreau
-- OR b.CodeImpact <> a.CodeImpact
-- OR b.DescriptionImpact <> a.DescriptionImpact
-- OR b.CodePromotionLiee <> a.CodePromotionLiee
-- OR b.StatutPromotion <> a.StatutPromotion
OR b.DateDebutPromotion <> a.DateDebutPromotion
OR b.DateFinPromotion <> a.DateFinPromotion
OR b.DateDebutMagasin <> a.DateDebutMagasin
OR b.DateFinMagasin <> a.DateFinMagasin
OR b.MontantFixe <> a.MontantFixe
OR b.VolumeProjete <> a.VolumeProjete
)
UPDATE DW.dbo.DIMPromotion
SET DescriptionPromotion = b.DescriptionPromotion
,DescriptionCirculaire = b.DescriptionCirculaire
,DescriptionCarreau = b.DescriptionCarreau
,CodeImpact = b.CodeImpact
,DescriptionImpact = b.DescriptionImpact
,CodePromotionLiee = b.CodePromotionLiee
,StatutPromotion = b.StatutPromotion
,DateDebutPromotion = b.DateDebutPromotion
,DateFinPromotion = b.DateFinPromotion
,DateDebutMagasin = b.DateDebutMagasin
,DateFinMagasin = b.DateFinMagasin
,MontantFixe = b.MontantFixe
,VolumeProjete = b.VolumeProjete
FROM DW.dbo.DIMPromotion a
JOIN #DimPromotion b ON b.CodePromotion = a.CodePromotion
-- AND b.CodeCirculaire = a.CodeCirculaire
AND b.CodeCarreau = a.CodeCarreau
AND b.NumeroContrat = a.NumeroContrat
AND
(
b.DescriptionPromotion <> a.DescriptionPromotion
OR b.DescriptionCirculaire <> a.DescriptionCirculaire
OR b.DescriptionCarreau <> a.DescriptionCarreau
OR b.CodeImpact <> a.CodeImpact
OR b.DescriptionImpact <> a.DescriptionImpact
OR b.CodePromotionLiee <> a.CodePromotionLiee
OR b.StatutPromotion <> a.StatutPromotion
-- OR b.DateDebutPromotion <> a.DateDebutPromotion
-- OR b.DateFinPromotion <> a.DateFinPromotion
-- OR b.DateDebutMagasin <> a.DateDebutMagasin
-- OR b.DateFinMagasin <> a.DateFinMagasin
-- OR b.MontantFixe <> a.MontantFixe
-- OR b.VolumeProjete <> a.VolumeProjete
)
This ensure me that there is no conversion error in the statement itself… I’m I missing something here ? Is there a maximum number of charater we can put in a statement (or a join clause)?
Thanks for your help,
Eric Brochu
October 18, 2005 at 9:00 am
Eric,
Are you actually executing the statements with the commented part or are they just compiled in a stored proc?
also can you post the DDL of "DW.dbo.DIMPromotion" and "#DimPromotion" ?
* Noel
October 18, 2005 at 9:03 am
Impossible to help without the DDL and datatypes of the columns involved.
When you comment parts of a join, the resultset is different, therefore rows that are triggering the type conversion error in statement #1 may be absent from the resultset in statements #2 and #3.
October 18, 2005 at 9:24 am
OK,
My bad ...I learned today not to trust what was developed and/or the analyzed prior to your involvement in a project.
TABLE [dbo].[DIMPromotion](
IDENTITY(1,1) NOT NULL,
(5) NOT NULL,
(30) NULL,
(2) NOT NULL,
(20) NULL,
NOT NULL,
(30) NULL,
NOT NULL,
(1) NULL,
(15) NULL,
NOT NULL,
(5) NULL,
(1) NOT NULL,
NOT NULL,
NULL,
NOT NULL,
NULL,
(18, 2) NULL,
NULL,
NOT NULL
) ON [PRIMARY]
Thanks,
Eric
October 18, 2005 at 11:57 am
Try this:
SELECT CodeCarreau
FROM DimPromotion
WHERE ISNUMERIC(CodeCarreau) = 0
Then try the same thing with NumeroContrat.
Anything that is returned will be values that can not be converted.
-SQLBill
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply