Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it L'avatar di nourdine
    Registrato dal
    Nov 2005
    Messaggi
    1,130

    "not null" che non funziona

    su phpmyadmin imposto un campo "VARCHAR not null" e imposto il valore predefinito a "XYZ". Se durante l'inserimento dati il valore è mancante non viene inserito in automatico il valore XYZ come mi aspetto datto che ho impostato il "not null"


    dove sbaglio??

  2. #2
    bisognerebbe valutare la versione, la tabella e come viene inserito il valore.... se metti per esempio il valore come empty, vuoto, inserira' nulla e non il default.

    Per avere il default dovresti omettere campo/valore.

    Il silenzio è spesso la cosa migliore. Pensa ... è gratis.

  3. #3
    Utente di HTML.it L'avatar di byaur
    Registrato dal
    Aug 2004
    Messaggi
    1,061
    guida di mysql???



    ...
    If the column cannot take NULL as the value, MySQL defines the column with no explicit DEFAULT clause. For data entry, if an INSERT or REPLACE statement includes no value for the column, MySQL handles the column according to the SQL mode in effect at the time:

    *If strict SQL mode is not enabled, MySQL sets the column to the implicit default value for the column data type.

    *If strict mode is enabled, an error occurs for transactional tables and the statement is rolled back. For non-transactional tables, an error occurs, but if this happens for the second or subsequent row of a multiple-row statement, the preceding rows will have been inserted.
    ....


    Chi di noi non vorrebbe
    sollevare il velo sotto cui sta nascosto il
    futuro...
    David Hilbert

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.