Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. DECLARE @xmltbl TABLE (ID INT, XmlData XML)
  2. INSERT INTO @xmltbl(ID, XmlData)
  3. VALUES((select Id from News where sId=129),(select content from News where sId=129));
  4. ;WITH XMLNAMESPACES (DEFAULT 'http:microsoft.com')
  5. SELECT ID, C.value('(.)[1]', 'varchar(1000)') DataText FROM @xmltbl
  6. CROSS APPLY
  7. XmlData.nodes('/BreezyCalc/Graph/point') n (C)
  8.  
  9. select DataText from @xmltbl
  10.  
  11. if (DataText ="")
  12. BEGIN
  13. INSERT INTO @xmltbl(ID, XmlData)
  14. VALUES((select Id from News where sId=129),(select content from News where sId=129));
  15. ;WITH XMLNAMESPACES (DEFAULT 'http://schemas.microsoft.com/winfx/2006/xaml/presentation')
  16. SELECT ID, C.value('(.)[1]', 'varchar(1000)') DataText FROM @xmltbl
  17. CROSS APPLY
  18. XmlData.nodes('BreezyCalc/Graph/point/@Text') n (C)
  19.  
  20. select DataText from @xmltbl
  21.  
  22. END
  23.  
  24. ID DataText
  25. -------------------
  26. 129 |lines added
  27.  
  28. DECLARE @Datatext as varchar(200)=''
  29. ,IDParameter as Int = 129
  30. SET @Datatext= (select top 1 XMLData from @xmltbl where ID=@IDParameter)
  31.  
  32. if ISNULL(@DataText,'') =''
  33. BEGIN
  34. some code here
  35. END
  36. ELSE IF (Some Other Condition)
  37. BEGIN
  38. some code here
  39. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement