File: cast_conversion.sql

package info (click to toggle)
sqlfluff 3.5.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,000 kB
  • sloc: python: 106,131; sql: 34,188; makefile: 52; sh: 8
file content (38 lines) | stat: -rw-r--r-- 590 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
select cast(col1 as integer)
from tbl1;

select convert(integer, col1)
from tbl1;

select col1::integer
from tbl1;

select cast(col1 as timestamptz)
from tbl1;

select convert(timestamptz, col1)
from tbl1;

select col1::timestamptz
from tbl1;

select cast(col1 as decimal(38, 2))
from tbl1;

select convert(decimal(38, 2), col1)
from tbl1;

select col1::decimal(38, 2)
from tbl1;

select cast(col1 as interval)
from tbl1;

select convert(interval, col1)
from tbl1;

select col1::interval
from tbl1;

select cast(pg_namespace.nspname as information_schema.sql_identifier)
from pg_namespace;