---居然看到有人用游标,SQL就能搞定---- createtableTest (F1char(10), F2char(10)) --测试表 insertintoTest select'a'F1,'1'F2 union select'b'F1,'2'F2 union select'c'F1,'3'F2 union select'd'F1,'3'F2 union select'e'F1,'4'F2 union select'f'F1,'4'F2 union se
社区里有人提问一个行转列的应用,在SQLServer中都是用Case的,我随便答了一下,由于是非固定行,有网友给我发消息问怎么实现,详细来说一下。 相关联接 http://community.csdn.net/Expert/topic/3417/3417326.xml?temp=.8530084 Answer: 表 F1 F2 jack book1 jack bo
if not exists (select * from dbo.sysobjects where id = object_id(N'[IndexTable]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) create table IndexTable(Ex char(20), num integer) go create procedure SetIndex @Ex char(20),@result char(30) output,@Fmt in