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 |
|
Newbie2005
Starting Member
29 Posts |
Posted - 2006-03-31 : 17:48:28
|
| How I can make this stored procedure to update if it can not insert this? please helpset ANSI_NULLS ONset QUOTED_IDENTIFIER ONgo/*sample input xml<MessageItemList> <Id value="2"/> <Id value="223"/></MessageItemList>*/ALTER PROCEDURE [dbo].[isp_AddToTag] ( @TagId INT, @MessageItemXml xml )ASBEGIN SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON SET ARITHABORT ON INSERT INTO TagMessageMap SELECT @TagId, T.a.value('@value','int'),GETUTCDATE() FROM @MessageItemXml.nodes('/MessageItemList/Id') T(a)END |
|
|
chiragkhabaria
Master Smack Fu Yak Hacker
1907 Posts |
Posted - 2006-04-01 : 01:29:39
|
| I didnt understood the what do you really want to do. something like if the following code is not able to insert then you need to write the update statement.. ALTER PROCEDURE [dbo].[isp_AddToTag]( @TagId INT,@MessageItemXml xml)ASBEGINSET QUOTED_IDENTIFIER ONSET ANSI_NULLS ONSET ARITHABORT ONINSERT INTO TagMessageMapSELECT @TagId, T.a.value('@value','int'),GETUTCDATE()FROM @MessageItemXml.nodes('/MessageItemList/Id') T(a)if @@ROWCOUNT=0 Begin -- Write your update statment here.. End ENDHope these helpsIf Debugging is the process of removing Bugs then i Guess programming should be process of Adding them. |
 |
|
|
|
|
|