2010-10-12 12 views
17

जब मैं एसएसआरएस आईडीई में डेटासेट सेट करने का प्रयास करता हूं, तो मुझे स्नैपशॉट में दिखाई देने वाली त्रुटि मिलती है।"एक ही कुंजी वाला एक आइटम पहले ही जोड़ा जा चुका है" एसएसआरएस पर त्रुटि डेटासेट सेट करने का प्रयास करते समय

क्वेरी SQL सर्वर प्रबंधन स्टूडियो में पूरी तरह से ठीक काम करती है, मुझे आश्चर्य है कि मैं गलत कहां गया ?!

डीबी से कनेक्शन अच्छी तरह से स्थापित है।

alt text


वैकल्पिक:

मामले में आप अपनी क्वेरी (अपने बहुत लंबा है) पर एक नजर है करना चाहते हैं, मैं इसे बहुत अच्छी तरह से जाँच की। कुछ भी नहीं है उस में गलत:

SELECT Customer.customerID, Customer.companyName, CustomerInvoice.dueDate, CustomerInvoice.cuInvoiceID, CustomerQuote.PONumber, Product.productName, CASE WHEN (SELECT  isTaxPaid 
                FROM   SupplierQuoteProducts 
                WHERE  productID = CustomerQuoteProducts.ProductID) = 1 THEN CustomerQuoteProducts.unitPrice * 1.15 
                WHEN (SELECT  isTaxPaid 
                FROM   SupplierQuoteProducts 
                WHERE  productID = CustomerQuoteProducts.ProductID) = 0 THEN CustomerQuoteProducts.unitPrice 
                ELSE CustomerQuoteProducts.unitPrice 
                END AS "unitPrice", 
         CustomerQuoteProducts.qty, CustomerQuoteProducts.isTaxPaid, PaymentMethod.paymMethDesc, CustomerInvoice.customerQuoteID, CustomerInvDetail.paidDate, CustomerInvDetail.clearedDate, 
         CustomerInvDetail.notes, CustomerInvDetail.sentDate, PaymentExpected.payExpectedTitle, PaymentStatus.paymentStatusTitle, 
CASE WHEN 
(SELECT  isTaxPaid 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 1 AND CustomerQuoteProducts.qty > 0 AND 
CustomerQuoteProducts.isTaxPaid > 0 THEN (((CustomerQuoteProducts.unitPrice * 1.15) * 1.15) * CustomerQuoteProducts.qty) WHEN 
(SELECT  isTaxPaid 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 1 AND CustomerQuoteProducts.qty <= 0 AND 
CustomerQuoteProducts.isTaxPaid > 0 THEN ((CustomerQuoteProducts.unitPrice * 1.15) * 1.15) WHEN 
(SELECT  isTaxPaid 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 0 AND CustomerQuoteProducts.qty > 0 AND 
CustomerQuoteProducts.isTaxPaid > 0 THEN ((CustomerQuoteProducts.unitPrice * CustomerQuoteProducts.qty) * 1.15) WHEN 
(SELECT  isTaxPaid 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 0 AND CustomerQuoteProducts.qty <= 0 AND 
CustomerQuoteProducts.isTaxPaid > 0 THEN (CustomerQuoteProducts.unitPrice * 1.15) WHEN 
(SELECT  Count(isTaxPaid) 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 0 AND CustomerQuoteProducts.qty > 0 AND 
CustomerQuoteProducts.isTaxPaid > 0 THEN ((CustomerQuoteProducts.unitPrice * 1.15) * CustomerQuoteProducts.qty) WHEN 
(SELECT  Count(isTaxPaid) 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 0 AND CustomerQuoteProducts.qty <= 0 AND 
CustomerQuoteProducts.isTaxPaid > 0 THEN (CustomerQuoteProducts.unitPrice * 1.15) WHEN 
(SELECT  isTaxPaid 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 1 AND CustomerQuoteProducts.qty > 0 AND 
CustomerQuoteProducts.isTaxPaid <= 0 THEN (((CustomerQuoteProducts.unitPrice * 1.15)) * CustomerQuoteProducts.qty) WHEN 
(SELECT  isTaxPaid 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 1 AND CustomerQuoteProducts.qty <= 0 AND 
CustomerQuoteProducts.isTaxPaid <= 0 THEN ((CustomerQuoteProducts.unitPrice * 1.15)) WHEN 
(SELECT  isTaxPaid 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 0 AND CustomerQuoteProducts.qty > 0 AND 
CustomerQuoteProducts.isTaxPaid <= 0 THEN ((CustomerQuoteProducts.unitPrice * CustomerQuoteProducts.qty)) WHEN 
(SELECT  isTaxPaid 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 0 AND CustomerQuoteProducts.qty <= 0 AND 
CustomerQuoteProducts.isTaxPaid <= 0 THEN (CustomerQuoteProducts.unitPrice) WHEN 
(SELECT  Count(isTaxPaid) 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 0 AND CustomerQuoteProducts.qty > 0 AND 
CustomerQuoteProducts.isTaxPaid <= 0 THEN ((CustomerQuoteProducts.unitPrice * CustomerQuoteProducts.qty)) WHEN 
(SELECT  Count(isTaxPaid) 
FROM   SupplierQuoteProducts 
WHERE  productID = CustomerQuoteProducts.ProductID) = 0 AND CustomerQuoteProducts.qty <= 0 AND 
CustomerQuoteProducts.isTaxPaid <= 0 THEN (CustomerQuoteProducts.unitPrice) END AS [TotalPrice], CASE WHEN row_number() OVER (partition BY 
CustomerInvoice.cuInvoiceId 
ORDER BY newid()) = 1 THEN (CASE WHEN CustomerShipping.isTaxPaid > 0 THEN (CustomerShipping.shippingPrice * 1.15) 
WHEN CustomerShipping.isTaxPaid <= 0 THEN (CustomerShipping.shippingPrice) END) END AS [ShippingCost], 
CASE WHEN row_number() OVER (partition BY 
CustomerInvoice.cuInvoiceId 
ORDER BY newid()) = 1 THEN (CASE WHEN CustomerShipping.isTaxPaidForOrigPr > 0 THEN (CustomerShipping.origShipPrice * 1.15) 
WHEN CustomerShipping.isTaxPaidForOrigPr <= 0 THEN (CustomerShipping.origShipPrice) END) END AS [ShippingOrigCost], 
CustomerShipping.isTaxPaid, 
CustomerShipping.isTaxPaidForOrigPr, 
CustomerShipping.shippingDate, CustomerShipping.trackingNumber, ShippingMethod.shippingVia, CustomerShipping.desAddress, 
CustomerShipping.desCity, CustomerShipping.desPOBox, CustomerShipping.desPostalCode, CustomerShipping.desProvince, CustomerShipping.descName, 
CustomerShipping.packageContent, CustomerShipping.cuShippingID, Country.countryName, CustomerShipping.packageDepth, 
CustomerShipping.packageHeight, CustomerShipping.packageWeight, CustomerShipping.packageWidth, CustomerShipping.pickUpLocation 
FROM   CustomerInvoice INNER JOIN 
         CustomerInvDetail ON CustomerInvoice.cuInvoiceID = CustomerInvDetail.cuInvoiceID INNER JOIN 
         CustomerQuote ON CustomerQuote.CustomerQuoteID = CustomerInvoice.CustomerQuoteID INNER JOIN 
         CustomerQuoteProducts ON CustomerQuoteProducts.CustomerQuoteID = CustomerQuote.CustomerQuoteID INNER JOIN 
         CustomerShipping ON CustomerShipping.CustomerQuoteID = CustomerInvoice.CustomerQuoteID INNER JOIN 
         PaymentStatus ON PaymentStatus.paymentStatusID = CustomerInvDetail.paymentStatusID INNER JOIN 
         Customer ON Customer.CustomerID = CustomerQuote.CustomerID INNER JOIN 
         Product ON CustomerQuoteProducts.productID = Product.productID INNER JOIN 
         Country ON Country.countryID = CustomerShipping.countryID INNER JOIN 
         ShippingMethod ON ShippingMethod.shippingMethodID = CustomerShipping.shippingMethodID INNER JOIN 
         PaymentExpected ON PaymentExpected.paymentExpectedID = CustomerInvDetail.paymentExpectedID INNER JOIN 
         PaymentMethod ON PaymentMethod.paymentMethodID = CustomerInvoice.paymentMethodID 
WHERE CustomerInvoice.cuInvoiceID = @cuInvID 

उत्तर

36

अपनी स्क्रिप्ट एक सा स्वरूपण के बाद, मैंने देखा एक ही नाम है कि आप चयन कर रहे हैं के साथ 2 कॉलम देखते हैं कि। अंतिम नाम & को बदलने के लिए सुनिश्चित करें कि जब आप प्रबंधन स्टूडियो में अपना कथन चलाते हैं तो प्रत्येक कॉलम में अद्वितीय नाम होता है।

कहा जा रहा है, दो कॉलम मैंने देखा है नकली नाम customerquoteproducts.istaxpaid और customershipping.istaxpaid

मुझे आशा है कि मदद करता है कर रहे हैं!

+0

मैं देख रहा हूँ का उपयोग करते हुए वापस बाद में सब कुछ जोड़ने के लिए याद करने के लिए था ...

, लेकिन इन समान स्तंभ पूरी तरह से अलग तालिकाओं में रहते हैं! मैं उपसर्ग का जिक्र करता हूं, इसलिए सिस्टम को भ्रमित नहीं किया जाना चाहिए ... आपकी मदद के लिए धन्यवाद, मैं इसे देख लूंगा ... –

+0

सोल्ड ............. –

+0

हाँ, एक और पागल, माइक्रोसॉफ्ट बीआई में असहज त्रुटि ... मुझे भी एक ही समस्या थी और यह काम किया –

0

आज मुझे इस पोस्ट में आया जब मुझे एक ही समस्या मिली। मेरी समस्या कितनी अलग थी।

मेरे पास एक अस्थायी तालिका और मेरे एसपी में एक कथन है।

DECLARE @myCheck as int 
SET @myCheck = 0 

SELECT @myCheck = CASE WHEN [checkfield] = 'xxx' then 1 else 0 end 
    FROM checktable 
    WHERE ... 


SELECT myfields.* 
into #temptable 
FROM mytable 
WHERE ... 


IF @myCheck = 1  --if ssrs does'nt want ot refresh your fields, remove hte if as it does not see past this... 
    select * 
    FROM #temptable 
     LEFT JOIN tableA 
      ON ... 
ELSE 
    select * 
    FROM #temptable 
     LEFT JOIN tableB 
      ON ... 

तो आदेश SSRS में मेरी क्षेत्रों "ताज़ा" करने के लिए, मैं बाहर तो बयान टिप्पणी की है और क्षेत्र के नाम के साथ अपने प्रश्नों में से एक में रखा: तो मेरी सपा कुछ इस तरह देखा। बस Visual Studio 2012/SQL 2012

संबंधित मुद्दे

 संबंधित मुद्दे