Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 13th, 2005, 12:21 PM
Authorized User
 
Join Date: Nov 2005
Posts: 72
Thanks: 3
Thanked 0 Times in 0 Posts
Default Using MID in SQL server

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
:)






Similar Threads
Thread Thread Starter Forum Replies Last Post
mid umeshtheone Beginning VB 6 1 June 11th, 2007 02:49 PM
migrating from sql server 2000 to sql server 2005 abinashpatra SQL Server 2005 2 December 1st, 2006 03:45 PM
CharIndex to split last, first and Mid name khautinh SQL Server 2000 4 June 28th, 2006 08:27 AM
VB fx mid -> PHP ? Mantis Pro PHP 1 March 3rd, 2005 10:08 AM
mid-function not working (i did something wrong) Haroldd Classic ASP Basics 3 February 11th, 2004 04:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.