我有很多删除查询,但在某些生产数据库中找不到某些表。我需要对这个问题做出简单的决定。
查询如
DELETE b.* FROM `table` b
JOIN `another_table` u
ON u.key2 = b.key
WHERE u.key3 <> ?
Run Code Online (Sandbox Code Playgroud)
我需要类似的东西:
IF TABLE `table` EXISTS DELETE b.* FROM `table` b ...
Run Code Online (Sandbox Code Playgroud) 在postgresql,如何从column.aINSERT中的column.b中的值来自同一个表Where
IF column.a = 1 then column.b = foo,
IF column.a = 2 then column.b = bar,
IF column.a = 3 then column.b = good,
IF column.a = 4 then column.b = bad
Run Code Online (Sandbox Code Playgroud) 我需要一个DataRow [] drs第一列的字符串数组.我试过下面的一行代码,但它没有用.
DataTable中的数据类型是Int,我需要将它转换为字符串数组.
我错过了一些吗?请建议我.
DataRow[] drs = ds.Tables[1].Select();
Run Code Online (Sandbox Code Playgroud)
对不起,我需要一个列值来串行数组.
string[] drsArray = drs
.AsEnumerable()
.Select(row => row.Field<string>("role_id")) //Here getting the exception
Run Code Online (Sandbox Code Playgroud)
我已经尝试了@Daniel的逻辑,它现在正在工作.现在是否有可能减少一些代码行.
string[] drsArray = (drs
.AsEnumerable()
.Select(row => row.Field<int>("role_id"))
.Select(i => i.ToString()).ToArray());
Run Code Online (Sandbox Code Playgroud)