Tag: 案例

如何在bash脚本的case语句中使用模式?

man页说, case语句使用“文件名扩展模式匹配”。 我通常希望有一些参数的短名称,所以我去: case $1 in req|reqs|requirements) TASK="Functional Requirements";; met|meet|meetings) TASK="Meetings with the client";; esac logTimeSpentIn "$TASK" 我尝试了req*或me{e,}t这样的模式,我知道它会正确扩展,以便在文件名扩展的上下文中匹配这些值,但不起作用。

SQL将值更改为大写或小写

你如何使一个sql select语句中的字段全部大写或小写? 例: 从Person中selectfirstname 我如何使firstname总是返回大写,同样总是返回小写?

SQL Server:将UniqueIdentifier转换为case语句中的string

我们有一个日志表,有一个消息列,有时有一个exception堆栈跟踪。 我有一些标准,确定消息是否有这个。 我们不希望将这些消息显示给客户,而是显示如下消息: 内部错误发生。 请使用参考代码xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx与我们联系 其中xxx等是表中的guid列。 我正在写这样的存储过程: declare @exceptionCriteria nvarchar(50) select @exceptionCriteria = '%<enter criteria etc>%' select LogDate, case when Message like @exceptionCriteria then 'Internal Error Occured. Reference Code: ' + str(RequestID) else Message end from UpdateQueue RequestID是SQL Server中的Guid数据types,在这里不会转换为string。 我已经看到了一些关于如何将Guid转换为string的代码,但它是multithreading的,我不认为它会在case语句中起作用。 有任何想法吗?

PostgreSQL交叉表查询

有没有人知道如何在PostgreSQL中创build交叉表查询? 例如,我有下面的表格: Section Status Count A Active 1 A Inactive 2 B Active 4 B Inactive 5 我想查询返回以下交叉表: Section Active Inactive A 1 2 B 4 5 这可能吗?