2、LIKE‘%inger‘ 将搜索以字母 inger 结尾的所有字符串(如 Ringer、Stringer)。6、LIKE‘[M-Z]inger‘ 将搜索以字符串 inger 结尾、以从 M 到 Z 的任何单个字母开头的所有名称(如 Ringer)。下面这句查询字符串是我以前写的,根据变量 zipcode_key 在邮政编码表 zipcode 中查询对应的数据,这句是判断变量 zipcode_key 为非数字时的查询语句,用 % 来匹配任意长度的字符串,从表中地址、市、省三列中查询包含关键字的所有数据项,并按省、市、地址排序。阅读全文>
发表于 @ 2007年04月18日 17:43:00|评论(loading...)|编辑|收藏
总结起来的关于SQL Server连接中此类四个最常见错误错误解决方案如下:一."SQL Server 不存在或访问被拒绝"这个是最复杂的,错误发生的原因比较多,需要检查的方面也比较多.要解决这个问题,我们一般要遵循以下的步骤来一步步找出导致错误的原因.阅读全文>
发表于 @ 2007年04月18日 10:35:00|评论(loading...)|编辑|收藏
eg:Select * from tableNameExec (‘select * from tableName‘)Exec sp_executesql N‘select * from tableName‘阅读全文>
发表于 @ 2007年04月18日 10:31:00|评论(loading...)|编辑|收藏
select @yd_num=count(jmzh) from jfxd.t_gongan_end_2 where SERIAL_NUMBER is not nullselect @lt_num=count(jmzh) from jfxd.t_gongan_end_2 where unicom is not nullselect @gh_num=count(jmzh) from jfxd.t_gongan_end_2 where tel is not nullselect @xlt_num=count(jmzh) from jfxd.t_gongan_end_2 where little_tel is not nullend.阅读全文>
发表于 @ 2007年04月18日 10:23:00|评论(loading...)|编辑|收藏
7、说明:添加主键: Alter table tabname add primary key(col) 说明:删除主键: Alter table tabname drop primary key(col) 8、说明:创建索引:create [unique] index idxname on tabname(col….) 删除索引:drop index idxname注:索引是不可更改的,想更改必须删除重新建。12、说明:使用外连接 A、left outer join: 左外连接(左连接):结果集几包括连接表的匹配行,也包括左连接表的所有行。阅读全文>
发表于 @ 2007年04月18日 10:18:00|评论(loading...)|编辑|收藏
快速比较结构相同的两表结构相同的两表,一表有记录3万条左右,一表有记录2万条左右,我怎样快速查找两表的不同记录?--添加主键,然后修改n1中若干字段的若干条alter table n1 add constraint pk_n1_id primary key (OrderID)alter table n2 add constraint pk_n2_id primary key (OrderID)阅读全文>
发表于 @ 2007年04月18日 10:17:00|评论(loading...)|编辑|收藏
1.说明:复制表(只复制结构,源表名:a 新表名:b) SQL: select * into b from a where 1.阅读全文>
发表于 @ 2007年04月18日 10:12:00|评论(loading...)|编辑|收藏