Saturday, June 1, 2013

[T-SQL] selecting Distinct value in a column based on values another column.

[T-SQL] selecting Distinct value in a column based on values another column.


selecting Distinct value in a column based on values another column.

Posted: 31 May 2013 04:35 PM PDT

Hi Experts,I have 2 columns as below --------------------------------taxid tax_Combination--------------------------------Bed+Vat ! VatBed+Vat ! CessBed+Vat ! BEDVAT ! VatCST ! CSTfrom a query i will get the Combinations like "Vat,Cess,BED", now i need to write a query where i have to pass these combinations and get the Taxid = 'Bed+Vat' alone.but when i us "IN" it returns 'Bed+Vat' and 'Vat' also.but i need to get the taxid for which the combination is exactly what i have given so it should be 'Bed+Vat' alone please help me.Thank you.

table type argument as OUTPUT in PROC

Posted: 31 May 2013 06:10 AM PDT

how can i define table type argument as OUTPUT in PROC and don't READONLY?if it's not possible, is there another way to do same this?thanks!

error on xml paramter in stored procedure

Posted: 31 May 2013 02:45 AM PDT

Hi. I have a stored procedure. It is written before two years. Now i need to run this. But i have a problem. Below, i show how i run stored procedure and values. These values comes from program.[quote]GODECLARE @return_value intEXEC @return_value = [dbo].[PRC_KLS_Rapor_DavranisNotlariListesi] @SiniflarXML = N'<?xml version=\"1.0\" encoding=\"utf-16\"?><IDLIST><ID VALUE=\"d4c810ba-36ea-4872-84d0-8c4cfe956e3c\" /><ID VALUE=\"62d6159f-809f-4b5e-9071-8058f47e57fc\" /></IDLIST>', @DonemID = 1, @DersYiliID = 'f7a801a6-f66f-4ae6-838a-33bdfb0fd52b'SELECT 'Return Value' = @return_valueGO[/quote]In stored procedure xml file processed as below:[quote]DECLARE @hDoc intEXEC sp_xml_preparedocument @hDoc OUTPUT, @SiniflarXML;SELECT VALUE INTO #tmpSiniflar FROM OpenXML(@hDoc, '/IDLIST/ID', 1) WITH (VALUE uniqueidentifier)EXEC sp_xml_removedocument @hDocSELECT * FROM Siniflar.....where S.DersYiliID = @DersYiliID AND S.SinifID IN (SELECT VALUE FROM #tmpSiniflar) AND ODN.DonemID = @DonemID[/quote]When i run SP, it gives below error.[quote]Msg 9413, Level 16, State 1, Procedure PRC_KLS_Rapor_DavranisNotlariListesi, Line 0XML parsing: line 1, character 15, A string literal was expected[/quote]I don't know weel xml on sql server. Can oneon help me about this? Thanks in advance.

No comments:

Post a Comment

Search This Blog