Re: Update Question

From: Anith Sen (anith_at_bizdatasolutions.com)
Date: 10/18/04

  • Next message: Przemek: "MSDE 2000 Sp3"
    Date: Mon, 18 Oct 2004 16:56:07 -0500
    
    

    You can do this using CASE in SQL like:

    UPDATE Car
       SET field1 = CASE passengers WHEN '3' THEN '2' END
     WHERE id = 1 ;

    Note that all the values for passengers that is not equal to '3' for id
    value 1 will be set to NULLs since there is no ELSE clause in the CASE
    expression. For more details and examples on CASE, please refer to SQL
    Server Books Online.

    -- 
    Anith 
    

  • Next message: Przemek: "MSDE 2000 Sp3"

    Relevant Pages

    • RE: Can u plz Compare n Contrast betn 2 Codes 4 Variable Reading/W
      ... Sorry that I didn't mention that you need to copy the link to the SQL ... Server Books Online installed with SQL 2005. ... Microsoft Online Partner Support ... When responding to posts, please "Reply to Group" via your newsreader so ...
      (microsoft.public.sqlserver.dts)
    • Re: Permissions List
      ... command and the ... >PERMISSIONS function to accomplish what you want. ... available in the SQL ... >Server Books Online. ...
      (microsoft.public.sqlserver.security)
    • Re: Select Statment
      ... Look up the topics LIKE and "Pattern Matching in Search Conditions" in SQL ... Server Books Online. ... Also, there are functions like PATINDEX, CHARINDEX etc ...
      (microsoft.public.sqlserver.programming)
    • Configure SQL XML support in IIS
      ... I used "Creating the nwind Virtual Directory" from SQL Server Books Online. ... in the browser type: http://>/nwind?sql=SELECT * FROM Employees FOR XML AUTO&root=root and press ENTER. ...
      (microsoft.public.sqlserver.tools)
    • Re: How to reduce the Log file
      ... Look at BACKUP LOG with NO_LOG option and DBCC SHRINKFILE statements in SQL ... Server Books Online. ...
      (microsoft.public.sqlserver.programming)