Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-04-22 : 21:39:33
|
ken writes "I wrote an asp to get 2 passed parameter(parmSNFrom, parmSNTo) and insert a batch of card serialno(varchar) into table (from parmFrom to parmTo). The format of serialno is the first 4 letters is the cardtype(such as "HC10") the last 6 letters are sequential numbers(from 000000 to 999999). I'm using the SQL: strSQL = "DECLARE @loop int " _ & "SELECT @loop = " & CLNG(MID(parmSNFrom_1, 5, 6)) & " " _ & "WHILE @loop < " & (CLNG(MID(parmSNTo_1, 5, 6)) + 1) & " " _ & "BEGIN " _ & " INSERT INTO PCard(SerialNo) " _ & " VALUES('" & LEFT(parmSNFrom_1, 4) & "' + replicate('0', (6 - len(@loop))) + convert(varchar, @loop) & "' " _ & " SELECT @loop = @loop + 1 " _ & "END "
db_conn.execute(strSQL)
But if I wan to insert 1000 number, for example parmSNFrom = "HC1000000000" and parmSNTo = "HC10000999". everytime I run this asp page. it just insert around 150 serialno. And there is no error message. I've used "response.write(strSQL) response.end" to get the strSQL value for debuging. I copy and paste the strSQL in QueryAnalyzer and run the script. It can exactly insert 1000 serialno. So weird!!!
I'm currently using a walkaround solution for this problem. I'm using a store procedure to replace the strSQL. It also works fine.
Anyone can help me with this question. It has buggered me for 2 days. Plus it's a very interesting question. ;-))
Thanz in advance" |
|
|
|
|
|