Guest User

Untitled

a guest
Jan 23rd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. Select *
  2. from tableA
  3. inner join tableB on tableA.id = tableB.aid
  4. and cast(a.date AS DATETIME) = CAST('2015-08-24' AS DATETIME)
  5.  
  6. select *
  7. from tableA
  8. inner join tableB on tableA.id = tableB.aid
  9. and cast(a.date AS DATETIME2(3)) = CAST('2015-08-24' AS DATETIME2(3))
  10.  
  11. Select * from tableA inner join tableB
  12. on tableA.id = tableB.aid
  13. and ISDATE(tableA.date)
  14. and cast(tableA.date AS DATETIME) = CAST('2015-08-24' AS DATETIME)
  15.  
  16. Select * from tableA inner join tableB
  17. on tableA.id = tableB.aid
  18. and cast(a.date AS DATETIME) = CAST('20150824' AS DATETIME)
  19.  
  20. Select * from tableA inner join tableB
  21. on tableA.id = tableB.aid
  22. and case when substring(a.date, 1, 2) not in ('19', '20') then null else CAST(a.date AS DATETIME) end = CAST('20150824' AS DATETIME)
Add Comment
Please, Sign In to add comment