河南新华电脑学院
欢迎 游客 , 注册 | 登录 | 会员 | 界面 | 简洁版本 | 在线 | 帮助
河南新华电脑学院

发表新主题 回复该主题
本主题被查看313次, 共2个帖子, 1页, 当前为第1页     选择页数: 1      跳转到第   上一主题   下一主题
标题: Sql 数组!
兰习刚
注册会员
UID: 115
来自:
精华: 0
积分: 157
帖子: 125
注册: 2007-9-12 13:42:35
状态: 离线
威望: 32.04
金钱: 3.65 元
只看楼主 2008-06-25 15:08
Sql 数组!
If @LargessCard<>'' And @LargessCardCount<>''
Begin
Set @CardLen=Len(Replace(@LargessCard,'|','||'))-Len(@LargessCard)
  While @i<=@CardLen
  Begin
  --比如:原来@largessCard=|12345|6789|abcde
  Set @theLargess=Right(@LargessCard,Len(@LargessCard)-1)    --12345|6789|abcde
  Set @StartStation=1          --1
  Set @EndStation=CharIndex('|',@theLargess)-1        --5
  Print @theLargess
  Print CharIndex('|',@theLargess)
  If @EndStation>0
  Begin
  Set @theCard=Cast(SubString(@theLargess,@StartStation,@EndStation) as Int)      --12345
  Set @LargessCard=Right(@theLargess,Len(@theLargess)-@EndStation)    --|6789|abcde
  End
  Else
  Begin
  Set @theCard=Cast(@theLargess as Int)      --abcde
  Set @LargessCard=@theLargess      --abcde
  End
  Set @theLargessCount=Right(@LargessCardCount,Len(@largessCardCount)-1)
  Set @StartStation=1
  Set @EndStation=CharIndex('|',@theLargessCount)-1
  If @EndStation>0
  Begin
  Set @theCount=Cast(SubString(@theLargessCount,@StartStation,@EndStation) as Int)      --12345
  Set @LargessCardCount=Right(@theLargessCount,Len(@theLargessCount)-@EndStation)
  End
  Else
  Begin
  Set @theCount=Cast(@theLargessCount as Int)
  Set @LargessCardCount=@theLargessCount
  End
  Select @theName=CardName From Card Where CardId=@theCard
  Insert Into ShoppingStorage(userid,username,cardid,cardname,cardcount,buydatetime,IsLargess) values(@userid,@username,@theCard,@theName,@theCount,GetDate(),1)
  Set @i=@i+1
  End
End

做网站的不如,做网站优化的;做网站优化的不如做网站营销的。
#1  
hufangyuan
管理员
UID: 1
来自:
精华: 10
积分: 464
帖子: 394
注册: 2006-10-19 13:36:00
状态: 离线
威望: 20.00
金钱: 112.24 元
2008-06-25 17:59
回复:Sql 数组!
现在搞得不错呀

做人如同做技术!!
低调做人,高标准做事
#2  
发表新主题 回复该主题
本主题被查看313次, 共2个帖子, 1页, 当前为第1页     选择页数: 1      跳转到第







现在的时间是 2008-10-12 11:23:34

版权所有 河南新华电脑学院  
          1.0.2642 (RC2)   Copyright © 2001-2008 Comsenz Inc.
Processed in 0.352 seconds