如下所示:将存储过程sp_Compute_Distance的内容导入到数据表t_Tmp_Txt中if exists (select * from sysobjects where name = 't_Note_Parameter') drop table t_Note_Parameter
go
create table t_Note_Parameter
(
    latitude int not null,
    longitude int not null,
    distance int null,
    primary key(latitude, longitude)
)
goif exists (select * from sysobjects where name = 'sp_Compute_Distance') drop procedure sp_Compute_Distance
go
create procedure sp_Compute_Distance
as
begin
    update t_Note_parameter set distance = sqrt(latitude*latitude) + sqrt(longitude*longitude)
end
goif exists (select * from sysobjects where name = 't_Tmp_Txt') drop table t_Tmp_Txt
create table t_Tmp_Txt (
    [txt] text
)
go insert into t_Tmp_Txt exec sp_helptext sp_Compute_Distanceselect * from t_Tmp_Txt 结果显示为: txt                                                                                                                                              
 ------------------------------------------------------------------------------------------------------------------------------------------------ 
 create procedure sp_Compute_Distance
as
begin
    update t_Note_parameter set distance = sqrt(latitude*latitude) + sqrt(longitude*longitude)
end  1 record(s) selected [Fetch MetaData: 0/ms] [Fetch Data: 0/ms] 
 
结果记录只有一条,t_Tmp_Txt每条数据记录255个字节的内容,现在希望在插入时能够按行分段,
即存储过程sp_Compute_Distance的每一行信息插入一条记录,期望的结果显示应该是5条
 txt                                                                                                                                              
 ------------------------------------------------------------------------------------------------------------------------------------------------ 
 create procedure sp_Compute_Distance
as
begin
    update t_Note_parameter set distance = sqrt(latitude*latitude) + sqrt(longitude*longitude)
end  5 record(s) selected [Fetch MetaData: 0/ms] [Fetch Data: 0/ms] 
 
有谁知道该如何改写这条insert语句来实现这个功能,谢谢!
insert into t_Tmp_Txt exec sp_helptext sp_Compute_Distance

解决方案 »

  1.   


    insert into  t_Tmp_Txt exec sp_helptext sp_Compute_Distance--(5 行受影响)我的是2005 显示五行。
      

  2.   

    create table  #t_Tmp_Txt (
      [txt] text
    )insert into  t_Tmp_Txt exec sp_helptext sp_Compute_Distanceinsert into t_Tmp_Txt SELECT *FROM #t_Tmp_Txt
    不太明白你为什么要显示5行受影响呢?
      

  3.   

    每一行信息存到t_Tmp_Txt的一条记录中,因为我还要取出来进行处理,
    如果是每255个字节记录一条记录的话,就会破坏信息结构,导致无法处理。
    你在SQL 2005的t_Tmp_Txt里面是5条记录吗?每条记录对应sp_Compute_Distance的一行信息吗?
    能否把t_Tmp_T的结果显示给我看看,谢谢如果你那边可以的话就证明应该通过某些SQL配置来实现