|
|
兰习刚 |
|
注册会员
|
UID: 115
来自:
精华: 0
积分: 157
帖子: 125
注册: 2007-9-12 13:42:35
状态:
离线
威望: 32.04
金钱: 3.65 元
|
|
|
|
|
| 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
|
|
|
|