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.
| Author |
Topic |
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2010-01-11 : 04:58:06
|
Hi all, i want to get all details of journals...by passing journalid ... sometimes i have get some many journals details... so i have decided like input parameter is passed as xml parameter ..but Sp is not working .. its not showing any details in the output...this how i have done it.. please help to resolve this issuemy SP is like thisSET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGO/*exec SelectByJournalIdList '<id> 3 </id>'*/ ALTER PROCEDURE [dbo].[SelectByJournalIdList](@JournalIds xml) ASDECLARE @Journals TABLE (ID int)declare @idoc intINSERT INTO @Journals(ID)SELECT Node.value('.','VARCHAR(20)')FROM @JournalIds.nodes('/Journals/id') as ParamValues(ID) SELECT * FROM dbo.FIS_Field as f --ProductsINNER JOIN @Journals jON f.Field_ID= j.ID--Products.ProductID = p.ID Regards,Divya |
|
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2010-01-11 : 05:04:25
|
| i have made a little change in slect statementINSERT INTO @Journals(ID)SELECT Node.value('ID','VARCHAR(20)')FROM @JournalIds.nodes('/Journals/id') as ParamValues(ID) im getting error like thisMsg 4121, Level 16, State 1, Procedure SelectByJournalIdList, Line 12Cannot find either column "Node" or the user-defined function or aggregate "Node.value", or the name is ambiguous.Regards,Divya |
 |
|
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2010-01-11 : 05:25:41
|
Hi all,, atlast i found it out now its working fine/*exec SelectByJournalIdList '<Journals><id value="3"/><id value="1"/></Journals>'*/ ALTER PROCEDURE [dbo].[SelectByJournalIdList](@JournalIds xml) ASDECLARE @Journals TABLE (ID int)declare @idoc intINSERT INTO @Journals(ID)SELECT Node.value('@value','VARCHAR(20)')AS aFROM @JournalIds.nodes('/Journals/id') as ParamValues(Node) SELECT * FROM dbo.FIS_Field as f --ProductsINNER JOIN @Journals jON f.Field_ID= j.IDRegards,Divya |
 |
|
|
|
|
|
|
|