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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Updating Multiple Rows In A Table With One Statement

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-11-08 : 23:32:47
Kimberly writes "How can one update multiple rows in a table with one statement?
For Instance -

Table.Cats

Fields
stKey, stName, stColor , stFood, stOwner

Row 1
1, Fluffy, Black, Whiskas, Kim
Row 2
2, Boris, White, Friskies, Kim
Row 3
3, Clyde, Gray, MeowMix, Kim

Using Asp, one can retrieve all the data into a new form
so that the data can be changed:


Owner = Request("owner") 
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Open "DSN=pets"

SQLStmt = "SELECT * from cats "
SQLStmt = SQLStmt & " WHERE owner LIKE '%" & owner "%' "

Response.write SQLStmt

Set RS = Connection.Execute(SQLStmt)

If rs.eof then
response.write "Sorry, no records were matched."
set connection=nothing
response.end
end if
Then once it is inserted into a html file with typeover fields,
and say the following information is changed:

Row 1
1, Fluffy, Black, Friskies, Kim
Row 2
2, Boris, Black, Friskies, Kim
Row 3
3, Clyde, Calico, MeowMix, Kim

What SQL statement can you use to change all three statements at once?

This one has caused me to want to slit my wrists repeatedly."
   

- Advertisement -