需求:reids中删除某个前缀的所有key 说明:代码中的0:2标识从key前缀中截取前2个字符,这里示例的时候比如“b_”前缀,使用时候根据实际情况截取对应的长度进行判断即可. 生成测试数据 #!/bin/bash ID )) do redis -a abc123 set "a_$ID" "$ID" redis -a abc123 set "b_$ID" "$ID" redis -a abc123 set "c_$
) DECLARE tmpCur CURSOR FOR SELECT name FROM sys.objects WHERE TYPE='U' AND name LIKE N'HSUPA%' OPEN tmpCur FETCH NEXT FROM tmpCur INTO @Table BEGIN ) SELECT @sql = 'drop table ' + @Table EXEC(@sql) FETCH NEXT FROM tmpCur INTO @Table END CLOSE tmpCur