Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: UPDATEing based on data already in a table


Message #1 by kenneth.tickner@e... on Mon, 25 Feb 2002 10:57:07
Kenneth:

A day after posting my last message, I noticed that my code had an error 
in it.  Sorry 'bout the lack of quality control.  Here's a brief 
correction to the code in my previous message:

Bullet #2 should read:
----------------------

2. No it won't work in the exact way you wrote it because you are
   assigning two fields to a single variable.  You wrote:
 
     DECLARE @myvar varchar(50)
     SELECT @myvar = (SELECT * FROM fruits WHERE fruitname = @fruitname)

   What you would need to do is to write:

     DECLARE @myvar varchar(50)
     SELECT @myvar = fruitname FROM fruits WHERE fruitname = @fruitname

- Roger Nedel

  Nedel Software Solutions
  rnedel@b...

  Return to Index