本代码适用于: SQLSERVER2000/2005
SQL语句如下:
select c.name, t.name as type, c.length
,(case t.name
when 'nvarchar' then c.length/2
when 'nchar' then c.length/2
else c.length
end)
as reallength
from syscolumns c join systypes t
on c.xtype=t.xtype
where t.name <> 'sysname' and c.id=object_id('Table1')
-- 加了这句代码,可以使列按设计时的顺序输出
order by colorder ASC
为了方便使用,可将其封装成一个函数代码如下:



























这是一个运行结果:
Educational Codeforces Round 5 E. Sum of Remainders (思维题)
HDU 2256 Problem of Precision (矩阵快速幂)
Codeforces 597C. Subsequences (树状数组+dp)
Codeforces Round #292 (Div. 1) B. Drazil and Tiles (类似拓扑)
HDU 5794 A Simple Chess (Lucas + dp)
Codeforces Round #365 (Div. 2) D. Mishka and Interesting sum (离线树状数组+前缀xor)
Codeforces Round #313 (Div. 2) E. Gerald and Giant Chess (Lucas + dp)
进程内存空间的分布
快排,堆排与归并排序