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

    [MySql] TRUNCATE su più tabelle.

    Vorrei sapere quale è la sintassi per effettuare un TRUNCATE su più tabelle;
    il seguente codice mi restituisce un errore di sintassi
    codice:
    TRUNCATE TABLE `tab1`;
    TRUNCATE TABLE `tab2`;
    TRUNCATE TABLE `tab3`;
    
    /*o provato anche:*/
    
    TRUNCATE TABLE `tab1`, `tab2`, `tab3` ;
    grazie anticipatamente per ogni suggerimento
    cichity74

  2. #2
    Utente di HTML.it L'avatar di nicola75ss
    Registrato dal
    Nov 2004
    Messaggi
    12,923
    Codice PHP:
    $tabelle = array('tab1','tab2','tab3');
    foreach(
    $tabelle as $tabella)
     
    mysql_query("truncate $tabella") or die(mysql_error()); 

  3. #3
    ottimo

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 © 2024 vBulletin Solutions, Inc. All rights reserved.