过滤sql的正则表达式和索引碎片的处理
str = Regex.Replace(str, @"select|insert|exists|delete|script|<script>|chr|alter|where|like|union|join|set|declare|from|count\(|drop table|update|truncate|asc\(|mid\(|char\(|xp_cmdshell|exec master|netlocalgroup administrators|net user|""|and| *", "", RegexOptions.IgnoreCase);
str = Regex.Replace(str, @"<[^>]*?>|</[^>]*?>", "", RegexOptions.IgnoreCase);
str = Regex.Replace(str, @"<[^>]*?>|</[^>]*?>", "", RegexOptions.IgnoreCase);
return str;
如果 发现自己的 索引存在 碎片,如果数据库是企业版的
USE AdventureWorks;
GO
ALTER INDEX ALL ON Production.Product
REBUILD WITH (ONLINE = ON);
可以使用这个语句来重建
对于 在 30%左右碎片的 用RECONGIZE
>50% 使用REBUILD
REORGANIZE