MSSQL的存储过程里面怎么实现类似功能?
取得指定单元格的列名和对应某个单位格的值?
例如:
TIME_STAMP AA BB CC DD EE
2001-1-1 2.8 2.1 2.5 2.4 2.7
2001-2-1 2.3 2.2 2.5 2.5 2.9
2001-3-1 2.6 2.7 2.5 2.6 3.7
2001-4-1 2.1 2.4 2.5 2.1 4.7
2001-5-1 2.0 2.3 2.5 2.3 5.8
能否在存储过程里面实现,取到 "5.8 " 这个单元格所在的列名 "EE ",和5.8所在行的TIME_STAMP的值 "2001-5-1 " ?
谢谢
------解决方案--------------------这是个客户端的问题
具体看你用什么网格控件
------解决方案--------------------declare @i int
declare @date varchar(10)
declare @colname varchar(20),
@name = varchar(20)
whlie @i> 0 and @i <6
begin
select @colname = col_name(object_id( 'table '),i)
if (exists(slect * from where @colname = 5.8 ))
begin
set @name = @colname
select @date = TIME_STAMP from table where @colname = 5.8
end
set @i = @i + 1
end
select @name name,@date date