一张表A a字段长度不固定,长度为20、22、截取后六位,其他的不截取,
最好用一个公式或者存储过程写
最好用一个公式或者存储过程写
解决方案 »
- 我要查询数据库中第二大的数怎么做?
- 求救!WIN2003下不能打SP4的补丁!!!!
- 为什么sqlserver2000表中字段长度设为nvarchar(32),但却放不下32个字符(全是字母和数字),只好增长为34才可以?
- 请教select查询统计问题,解决问题立即结贴,在线等,谢谢了。
- 共享锁该怎样设置
- 求一条行列转换的SQL,大家帮我写下。
- 请高手出马,想到得某日期到今日已有几个月?能否实现?
- 如何使全文搜索达到like的效果
- 如何将图片写入Sql Server的Image字段(前台VFP)及其相关操作?
- 如何删除带有默认值的字段?
- SQL SERVER 2005:如何让服务器每一秒执行一个存储过程
- 一个数据表设计40个字段,行吗?
declare @a varchar(200)
set @a = '1234567890-abacadfdsf'
select right(@a,6)
select substring(@a,len(@a)-5,6)
两个都可以。
SET @str = 'asdfasdfasdfasdfasdfasdf'
SELECT RIGHT(@str,6)
SELECT SUBSTRING(@str,LEN(@str)-5,6)------
dfasdf(1 row(s) affected)
------
dfasdf(1 row(s) affected)
insert into t values('a')
insert into t values('b')
insert into t values('c')
insert into t values('d')
go select * from t
select m.team , n.team from t m, t n where m.team < n.team order by m.team ------------------a
b
c
d
----》a b
a c
a d
b c
b d
c d