summaryrefslogtreecommitdiffstats
path: root/tests/dialects/test_tsql.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-14 05:42:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-07-14 05:42:58 +0000
commitb0bf1ad1a196585c2d31bc38c554637fc4e2eec9 (patch)
tree2fe11cc45ff45169984b4dfb7b64661d1897ad9c /tests/dialects/test_tsql.py
parentAdding upstream version 17.3.0. (diff)
downloadsqlglot-b0bf1ad1a196585c2d31bc38c554637fc4e2eec9.tar.xz
sqlglot-b0bf1ad1a196585c2d31bc38c554637fc4e2eec9.zip
Adding upstream version 17.4.1.upstream/17.4.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/dialects/test_tsql.py')
-rw-r--r--tests/dialects/test_tsql.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/dialects/test_tsql.py b/tests/dialects/test_tsql.py
index 5426859..065cdd0 100644
--- a/tests/dialects/test_tsql.py
+++ b/tests/dialects/test_tsql.py
@@ -6,6 +6,11 @@ class TestTSQL(Validator):
dialect = "tsql"
def test_tsql(self):
+ self.validate_identity("UPDATE x SET y = 1 OUTPUT x.a, x.b INTO @y FROM y")
+ self.validate_identity("UPDATE x SET y = 1 OUTPUT x.a, x.b FROM y")
+ self.validate_identity("INSERT INTO x (y) OUTPUT x.a, x.b INTO l SELECT * FROM z")
+ self.validate_identity("INSERT INTO x (y) OUTPUT x.a, x.b SELECT * FROM z")
+ self.validate_identity("DELETE x OUTPUT x.a FROM z")
self.validate_identity("SELECT * FROM t WITH (TABLOCK, INDEX(myindex))")
self.validate_identity("SELECT * FROM t WITH (NOWAIT)")
self.validate_identity("SELECT CASE WHEN a > 1 THEN b END")
@@ -206,6 +211,30 @@ class TestTSQL(Validator):
)
self.validate_all(
+ "CAST(x as FLOAT(32))",
+ write={"tsql": "CAST(x AS FLOAT(32))", "hive": "CAST(x AS FLOAT)"},
+ )
+
+ self.validate_all(
+ "CAST(x as FLOAT(64))",
+ write={"tsql": "CAST(x AS FLOAT(64))", "spark": "CAST(x AS DOUBLE)"},
+ )
+
+ self.validate_all(
+ "CAST(x as FLOAT(6))", write={"tsql": "CAST(x AS FLOAT(6))", "hive": "CAST(x AS FLOAT)"}
+ )
+
+ self.validate_all(
+ "CAST(x as FLOAT(36))",
+ write={"tsql": "CAST(x AS FLOAT(36))", "hive": "CAST(x AS DOUBLE)"},
+ )
+
+ self.validate_all(
+ "CAST(x as FLOAT(99))",
+ write={"tsql": "CAST(x AS FLOAT(99))", "hive": "CAST(x AS DOUBLE)"},
+ )
+
+ self.validate_all(
"CAST(x as DOUBLE)",
write={
"spark": "CAST(x AS DOUBLE)",