---
title: "bat命令"
author: "dragonlin06"
date: "2010-06-22T20:36:10Z"
tags: []
categories: ["编程语言"]
slug: "bat"
draft: false
lastmod: "2010-06-26T17:41:39Z"
id: 696927
url: "https://dragonlin06.iteye.com/blog/696927"
---

http://www.iteye.com/topic/251609
http://yiyanwan77.iteye.com/blog/335208
http://www.iteye.com/wiki/taojintianxiastruts2/1616-15-to-run-and-test-procedures
http://1zebra.iteye.com/blog/428460
http://devsharp.iteye.com/blog/170093

http://database.group.iteye.com/group/topic/10294
http://powerclark.iteye.com/category/57443
http://andylin02.iteye.com/blog/420598

在tbl_phone表中有N条数据，phone字段中有的号码是带有*，#，+的，如：*9000   phone字段的数据类型为varchar

如果我需要使用sql语句的Convert（bigint，phone）对phone字段进行数据类型转换，然后按大小排序，如果phone字段中带有上面所说的号码的话，转换为bigint肯定会出错，

所以我用下面的sql语句对带有这些符号的号码进行过滤在转换：

select * from tbl_phone as p where 1=1  and p.softCoid=1 and p.domainid=0 and p.phone not like '%*%' 
and p.phone not like '%#%' and p.phone not like '%+%' and  CONVERT(bigint, p.phone)>=1000 


这样做是没有问题的，但是如果我加上排序的话（order by p.phone），就会报转换错误。但是如果我去掉红色部分的sql语句然后加上order by p.phone的话，就不会有问题了。


不转换为bigint型也可以查出phone>='1000'的数据，但就是不明白为什么加上这些条件以后就会出错。请高手指点。