我想datetime使用下面的SQL查询将值插入表(SQL Server)
insert into table1(approvaldate)values(18-06-12 10:34:09 AM);
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误信息. Incorrect syntax near '10'.
我用引号试了一下
insert into table1(approvaldate)values('18-06-12 10:34:09 AM');
Run Code Online (Sandbox Code Playgroud)
我收到此错误消息 Cannot convert varchar to datetime
请帮忙!谢谢.
我有3张桌子:
Table t1: Table t2: Table t3:
+----+----+ +----+----+ +----+----+
| i1 | i2 | | i2 | c2 | | i1 | c1 |
+----+----+ +----+----+ +----+----+
| 1 | 22 | | 11| cc | | 1 | e |
| 2 | 33 | | 22| bb | | 2 | f |
| 3 | 11 | | 33| aa | | 3 | g |
+----+----+ +----+----+ +----+----+
Run Code Online (Sandbox Code Playgroud)
并且我想使用表t1和列i1和i2从t2和c3从t3中选择colum c2,结果将是thins:
requested Tabel:
+----+----+
| c1 …Run Code Online (Sandbox Code Playgroud) 如何在命令行中逃避可能的连字符,如下所示:
$ for i in db1 db2 db1-db2; do su - postgres -c "psql -c \"alter database \"$i\" with connection limit = 0;\""; done
ALTER DATABASE
ALTER DATABASE ERROR: syntax error at or near "-" at character 19 LINE 1: alter database db1-db2 with connection limit = 0;
^
Run Code Online (Sandbox Code Playgroud)