BlockGet.sql 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /* syntax version 1 */
  2. pragma UseBlocks;
  3. insert into @t
  4. select
  5. Unwrap(cast(fdate as Date)) as `date`,
  6. Unwrap(cast(fdatetime as Datetime)) as `datetime`,
  7. Unwrap(cast(ftimestamp as Timestamp)) as `timestamp`,
  8. from Input;
  9. commit;
  10. SELECT
  11. DateTime::GetHour(`date`) as date_hour,
  12. DateTime::GetMinute(`date`) as date_minute,
  13. DateTime::GetSecond(`date`) as date_second,
  14. DateTime::GetMillisecondOfSecond(`date`) as date_msec,
  15. DateTime::GetMicrosecondOfSecond(`date`) as date_usec,
  16. DateTime::GetTimezoneId(`date`) as date_tz,
  17. DateTime::GetTimezoneName(`date`) as date_tzname,
  18. DateTime::GetHour(`datetime`) as datetime_hour,
  19. DateTime::GetMinute(`datetime`) as datetime_minute,
  20. DateTime::GetSecond(`datetime`) as datetime_second,
  21. DateTime::GetMillisecondOfSecond(`datetime`) as datetime_msec,
  22. DateTime::GetMicrosecondOfSecond(`datetime`) as datetime_usec,
  23. DateTime::GetTimezoneId(`datetime`) as datetime_tz,
  24. DateTime::GetTimezoneName(`datetime`) as datetime_tzname,
  25. DateTime::GetHour(`timestamp`) as timestamp_hour,
  26. DateTime::GetMinute(`timestamp`) as timestamp_minute,
  27. DateTime::GetSecond(`timestamp`) as timestamp_second,
  28. DateTime::GetMillisecondOfSecond(`timestamp`) as timestamp_msec,
  29. DateTime::GetMicrosecondOfSecond(`timestamp`) as timestamp_usec,
  30. DateTime::GetTimezoneId(`timestamp`) as timestamp_tz,
  31. DateTime::GetTimezoneName(`timestamp`) as timestamp_tzname,
  32. FROM @t;