Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [SqlServer] Difficoltà con query Update

    SSMS mi restituisce errore nel select e nel from..
    Qualcuno riesce a dirmi cosa sbaglio?

    codice:
    UPDATE [table1]
    	   
       SET [Campo1] = CASE WHEN 
                      Select([AAAAMM] FROM [table1] inner join [table2] on table1.Campo2 = table2.campo1 GO) < 201001 THEN 'Old' ELSE
    					
                      CASE WHEN
                      Select([AAAAMM] FROM [table1] inner join [table2] on table1.Campo2 = table2.campo1 GO) IS NULL OR
                      Select([AAAAMM] FROM [table1] inner join [table2] on table1.Campo2 = table2.campo1 GO) > 201004 THEN 'Next' ELSE
    					
                      Select([AAAAMM] FROM [table1] inner join [table2] on table1.Campo2 = table2.campo1 GO) END END
    					
      WHERE DtAggYearWK = 201026
      
    GO

  2. #2
    Ho trovato..

    - La parentesi va prima del Select e non dopo.
    - in tutte le tabelle dovevo specificare db.dbo.nometabella

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.