dbTalk Databases Forums  

Stored procedure

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Stored procedure in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
yokesanhoo@gmail.com
 
Posts: n/a

Default Stored procedure - 02-21-2006 , 08:17 PM






Dear All,
Really need ur guys help! My currenly assignment is convert all the
inner line sql in asp to store procedure, i facing a big problem for
this following code,pls give me a hand,

" For i = 1 To 10
If not fixQuote(Request.Form("txtDescription" & i)) = "" Then
strSQL = "INSERT INTO ack_item
(Ack_id,Part_no,Serial_no,Description,Qty,Itm) VALUES ("& strAckID
&",'"& fixQuote(Request.Form("txtPartNo" & i)) &"',"
strSQL = strSQL & "'"& fixQuote(Request.Form("txtSerialNo" & i))
&"','"& fixQuote(Request.Form("txtDescription" & i)) &"',"&
CheckComma(Request.Form("txtQty" & i)) &","
strSQL = strSQL & "'"& fixQuote(Request.Form("txtItm" & i)) &"')"
call SetConnection(strSQL,2)
End If
Next"
/*the upon code in write in asp language!*/
/*the below code i wrote in sql server */
i change it as a following stored procedure"
declare @i int
select @i = 1
while @i <10
Begin
select @i= @i + 1
if not 'desc_'+@i =''
Begin
Insert into ack_item (Ack_id,Part_no,Serial_no,Description,Qty,Itm)
Values
((ack_ + CAST(@i AS
varchar(12)),('partNo_'+convert(varchar,Exp(@i)),( 'serialNo_'+convert(varchar,Exp(@i)),('desc_'+conv ert(varchar,Exp(@i)),('qty_'+@i),('itm_'+@i))
End
Continue
End"
The problem i was facing now is how to make loop 10 different set data
in the insert stament? such as
ack_1,partNo_1,serialNo_1,desc_1,qty_1,itm_1?
izzit really look like really impossible for write in sql procedure ?
sorry for long posting?
kindly contact me ,yokesanhoo (AT) yahoo (DOT) com.cn


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.