Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. select distinct
  2. CLFIIK.AdID
  3. ,CLFIIK.AdGiverName
  4. ,CLFIIK.AdGiverEmail
  5. ,CLFIIK.Title
  6. ,left(CLFIIK.Descripton,200) +'...' as Descripton -- select 200 Caharacter and after 200 char it will add ...
  7. , case
  8. when CLFIIK.type = 1 then -- Wanted Events
  9. 'Wanted Event'
  10. when CLFIIK.type = 1 then -- offering Events
  11. 'Offering Event'
  12. else -- Neither Wanted no Offering Events
  13. 'No Event Yet'
  14. end as Type
  15. ,CASE
  16. WHEN DATEDIFF(HOUR, PublishedDate, GETDATE()) < 24 THEN
  17. CASE DATEDIFF(HOUR, PublishedDate, GETDATE())
  18. WHEN 1 THEN
  19. CONVERT(VARCHAR, DATEDIFF(HOUR, PublishedDate, GETDATE())) + ' hour ago'
  20. ELSE
  21. CONVERT(VARCHAR, DATEDIFF(HOUR, PublishedDate, GETDATE())) + ' hours ago'
  22. END
  23. ELSE
  24. REPLACE(CONVERT(VARCHAR, PublishedDate, 6), ' ', '-')
  25. END as PublishedDate
  26. ,CLFIIK.LastModifiedDate
  27. ,LM.LocalityName +', '+ CityM.CityName as Address
  28. ,CM.CategoryName
  29. ,CM.CategoryID
  30. from CLF.utblCLFAdInstanceInfoKeys as CLFIIK
  31. inner join
  32. dbo.utblCategoryMaster as CM on CM.CategoryID = CLFIIK.CategoryID
  33. inner join
  34. dbo.utblLocalityMaster as LM on LM.LocalityID = CLFIIK.LocalityID
  35. inner join
  36. dbo.utblCityMaster as CityM on CityM.CityID = LM.CityID
  37. left join
  38. CLF.utblCLFAdInstanceDtls as AdInsDeets on AdInsDeets.AdID = CLFIIK.AdID
  39. where @WhereClause;
  40.  
  41. Msg 4145, Level 15, State 1, Procedure udspGetCLFSearchResultEventList, Line 55
  42. An expression of non-boolean type specified in a context where a condition is expected, near ';'.
  43.  
  44. DECLARE @sql nvarchar(2000) = 'SELECT .... FROM ....'
  45. DECLARE @sqlwithwhere nvarchar(2000)
  46. SET @sqlwithwhere = @sql + @WhereClause
  47. EXEC sp_executesql @sqlwithwhere
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement