|
Subject:
|
Using MID in SQL server
|
|
Posted By:
|
rtr1900
|
Post Date:
|
12/13/2005 11:21:44 AM
|
Hi,
I first do a select in the database:
SQL="SELECT * FROM ARTICLES WHERE COMPANYNAME="MS""
Now I realize a DO WHILE and in the DO WHILE I do the next:
Do while NOT rs.EOF CN_temp=Right("000000" & rs("codearticle"), 6) cn_Final=((INT( MID(CN_TEMP,2,1))*3) sql2="UPDATE ARTICLeS SET CN_ARTICLE='"&cn_final&"' WHERE COMPANYNAME='MS'" rs2.open sql2, conn rs.Movenext LOOP
This works fine (if there are some spelling mistakes, don´t bother as the code works) althought it tell me after 30-40 seconds that there has been a timeout. So I thought mixing the two SQL SYNTAXES in one, but after several tries I am still stuck. I tried the next:
sql2="UPDATE ARTICLES SET CN_ARTICLE=((INT( MID(Right('000000' & codearticle, 6),2,1))*3)) WHERE companyname='MS'"
I thought this way, it ponly has to do ONE SQL, which 'supposely' wouldn´t give me a timeout (in my WEBSERVER, the timeout option is set at 600secs)
Anybody can give me a hint?
Thx,
David

|
|