易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL Server 中查询非中文,非英文,非数字的特殊列

今天在处理一个用户名数据库时,发现有些不正常的数据存在,按照逻辑,用户名只能是数字,字母,下划线和纯中文这样的字符组合存在,不应该有其他组合存在,但是发现数据库中由于各种历史原因,有些不正常的存在,如何找到这些异常数据,在CSDN的 SQL Server 版问了这样两个问题,如下: http://topic.csdn.net/u/20100111/14/529a21a1-3ea8-4263-a0d9-34e83be79b1d.html http://topic.csdn.net/u/20100111/15/c2a124c5-bc5b-4626-86ce-c5b862cf5cff.html 感谢CSDN的网友帮忙解决了这个问题,下面就是解决方法的汇总: if object_id('[t1]') is not null
drop table [t1]
create table [t1]([c] nvarchar(20))
insert [t1]
select 'aaa' union all -- 此数据不应该被搜索到
select 'bcds' union all -- 此数据不应该被搜索到
select 'a1' union all -- 此数据不应该被搜索到
select '啊' union all -- 此数据不应该被搜索到
select '^%' union all -- 应该搜索到
select 'ew1' union all -- 此数据不应该被搜索到
select '344' union all -- 此数据不应该被搜索到
select '__' union all -- 此数据不应该被搜索到
select '213_21' union all -- 此数据不应该被搜索到
select 'a_2' union all -- 此数据不应该被搜索到
select 'd' union all -- 此数据不应该被搜索到
select 'ddd' union all -- 此数据不应该被搜索到
select '电风扇' union all -- 此数据不应该被搜索到
select '★思寒★' union all -- 应该搜索到
select 'Ω' union all -- 应该搜索到
select 'トントン' union all -- 应该搜索到
select '***' union all -- 应该搜索到
select '///////' union all -- 应该搜索到
select '@-@' union all -- 应该搜索到
select '@小慧' union all -- 应该搜索到
select '~*晓菊*~' union all -- 应该搜索到
select '啊★洛' union all -- 应该搜索到
select '不思議の夜' union all -- 应该搜索到
select '(嘉宾)胡飞' union all -- 应该搜索到
select '--------------' -- 应该搜索到
select * from [t1] WHERE PATINDEX('%[0-9a-z_]%',c)=0
and PATINDEX('%[^吖-座]%',c) 0
 
另外感慨一下,CSDN的 SQL Server 版 问出问题到解决问题,竟然比Google 搜索答案还要快, SQL Server 版 的牛人真多, 而且回答的这么快,实在让人吃惊。


相关文档:

[转]SQL Server 2005 COM+ 目录要求警告

①。启动Distributed Transaction Coordinator 服务
        打开服务,在服务中找到Distributed Transaction Coordinator服务,选择“属性”;
        在“登录”选项卡中,选择“此帐户”,帐户名填写“N ......

我的一些笔记(基于SQL 2005)(统计信息的一些笔记)

---查询索引操作的信息
select * from sys.dm_db_index_usage_stats
--查询指定表的统计信息(sys.stats和sysobjects联合查询)
select
  o.name,--表名
  s.name,--统计信息的名称
  auto_created,--统计信息是否由查询处理器自动创建
  user_created--统计信息是否由用户显示创建
from
  ......

使执行的sql语句变为linux后台进程执行

前些日子,在操作数据库时,需要执行操作时间很久的sql语句。但是当时局域网网络情况不好,经常发生掉线的情况。
此时需要把执行的语句加入到oracle服务器上的后台进程中,去执行。操作过程如下:
1、首先把需要执行的sql语句写成脚本,存储到sql.sql中。并放置到数据库服务器某路径下.
2、执行如下linux命令即可:
&nb ......

Sql Server 函数ceiling

CEILING:
将参数 Number 向上舍入(沿绝对值增大的方向)为最接近的 significance 的倍数。例如,如果您不愿意使用像“分”这样的零钱,而所要购买的商品价格为 $4.42,可以用公式 =CEILING(4.42,0.1) 将价格向上舍入为以“角”表示。
语法
CEILING(number,significance)
Number 要四舍五入的数值 ......

sys.columns (SQL Server 2005 )

为包含列的对象(如视图或表)的每列返回一行。下面是包含列的对象类型的列表。
表值程序集函数 (FT)
内联表值 SQL 函数 (IF)
内部表 (IT)
系统表 (S)
表值 SQL 函数 (TF)
用户表 (U)
视图 (V)
列名 数据类型 说明
object_id
int
此列所属对象的 ID。
name
sysname
列名。在对象中是唯一的。
column_id
in ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号