Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. ...
  2.  
  3. BEGIN TRY
  4. -- SET NOCOUNT ON added to prevent extra result sets from
  5. -- interfering with SELECT statements.
  6. SET NOCOUNT ON;
  7.  
  8. SELECT
  9. NoteId,
  10. Url,
  11. Subject,
  12. Content,
  13. ExpiresAt,
  14. RemindAt
  15. FROM dbo.browsingnotes_Notes
  16. WHERE UserId = @UserId
  17. AND Hash = @Hash
  18. END TRY
  19. BEGIN CATCH
  20. SELECT
  21. NULL AS 'NoteId',
  22. NULL AS 'Url',
  23. NULL AS 'Subject',
  24. NULL AS 'Content',
  25. NULL AS 'ExpiresAt',
  26. NULL AS 'RemindAt'
  27. END CATCH
  28.  
  29. THROW [ { error_number | @local_variable },
  30. { message | @local_variable },
  31. { state | @local_variable }
  32. ] [ ; ]
  33.  
  34. SELECT
  35. NoteId,
  36. Url,
  37. Subject,
  38. Content,
  39. ExpiresAt,
  40. RemindAt
  41. FROM dbo.browsingnotes_Notes
  42. WHERE UserId = @UserId
  43. AND Hash = @Hash
  44. union
  45. select NULL, NULL, NULL, NULL, NULL, NULL
  46. where not exists ( select 42 from dbo.browsingnotes_Notes where UserId = @UserId and Hash = @Hash )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement