惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Jina AI
Jina AI
C
Check Point Blog
V
V2EX
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
P
Proofpoint News Feed
A
About on SuperTechFans
D
DataBreaches.Net
腾讯CDC
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
IT之家
IT之家
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
云风的 BLOG
云风的 BLOG
MongoDB | Blog
MongoDB | Blog
J
Java Code Geeks
博客园_首页
T
Tailwind CSS Blog
M
MIT News - Artificial intelligence
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - Charie

牛郎与织女的故事 给22岁自己的回信 所谓运气 一转眼最早的文章都20年前了,真吓人 wireshark解密本地https流量笔记 debian+apache+acme_tiny+lets-encrypt配置笔记 团队组建的一些想法 哈哈一下 好久不来了,过来锄草 DNS反射攻击阻止 北漂中~ 从来没有谁与谁是一路人,我们爱的往往是自己的幻想 不要跟亲戚谈生意 做一个严格要求自己的人 人类未来进化方向恶考 mysql 列所有表行数 恩,有那么一个人 00后厉害哇 。。。。 放弃微博,继续回来写月经
mssql表名列名对应语句
Charie · 2014-04-16 · via 博客园 - Charie
if exists (select * from tempdb..sysobjects where name like '#magic%')
drop table #magic
go
select a.name name,b.name col,c.name type 
into #magic 
from sysobjects a,syscolumns b,systypes c
where a.xtype = 'U' 
and a.id = b.id 
and b.xtype = c.xtype 
and b.xusertype = c.xusertype

--将结果加工
select (case when tmp3.no=1 then tmp3.name else ' ' end) name,col,type 
from 
(select top 100000000 name
 ,(select count(1) from #magic tmp1 
   where tmp1.name=tmp2.name 
   and tmp1.col<=tmp2.col) as no,col,type
   from #magic tmp2 
   order by name,col,type) 
tmp3

做个笔记