Sunday, 20 August 2017

Sybase Iq Binary Opzione


Binary tipi di dati Descrizione Per la memorizzazione dei dati binari grezzi, come immagini, in una notazione esadecimale simile, fino ad una lunghezza di (32K) 1 byte. Il tipo di dati UNIQUEIDENTIFIER viene utilizzato per la memorizzazione di UUID (noto anche come GUID) valori. dati binari inizia con i caratteri 0x o 0X e può includere qualsiasi combinazione di cifre e le lettere maiuscole e minuscole da A a F. È possibile specificare la lunghezza della colonna in byte, o utilizzare la lunghezza predefinita di 1 byte. Ogni negozi byte 2 cifre esadecimali. Anche se la lunghezza predefinita è 1 byte, Sybase consiglia di specificare sempre un numero pari di caratteri per BINARIO e VARBINARY lunghezza della colonna. Se si inserisce un valore superiore alla lunghezza della colonna specificata, Sybase IQ tronca la voce per la lunghezza specificata, senza avviso o errore. Dati binari binaria di byte di lunghezza lunghezza. Se la lunghezza è omesso, il valore predefinito è 1 byte. La dimensione massima consentita è di 255 byte. Utilizzare la lunghezza fissa di tipo binario binario per dati in cui si prevede tutte le voci di essere approssimativamente uguale lunghezza. Perché contenuto delle colonne binarie sono zeri alla lunghezza lunghezza della colonna. essi potrebbero richiedere più spazio di archiviazione di contenuto delle colonne VARBINARY. dati VARBINARY binari fino ad una lunghezza di byte max-length. Se max-length viene omesso, il valore predefinito è 1 byte. La dimensione massima consentita è (32K) 1 byte. Utilizzare la lunghezza variabile di tipo binario VARBINARY per i dati che si prevede di variare notevolmente in lunghezza. Come opzione con licenza separata, Sybase IQ supporta i dati binary large object (BLOB) con una lunghezza che va da zero (0) a 512TB (terabyte) per una dimensione pagina di QI di 128 KB o 2PB (petabyte) per una dimensione pagina di QI di 512 KB. La lunghezza massima è pari a 4 GB, moltiplicato per le dimensioni della pagina del database. Vedere i grandi oggetti di gestione in Sybase IQ. Per informazioni sui tipi di binario e di dati immagine Long, vedere i tipi di dati binari. Trattamento di zeri finali Tutte le colonne binari sono riempita con zeri per l'intera larghezza della colonna. zeri finali vengono troncati in tutte le colonne VARBINARY. L'esempio seguente crea una tabella con tutte e quattro le variazioni di tipi di dati binari e VARBINARY definite con NULL e NOT NULL. Gli stessi dati viene inserito in tutti e quattro colonne ed è imbottito o troncato in base al tipo di dati della colonna. la dipendenza della piattaforma La forma precisa in cui si inserisce un valore particolare dipende dalla piattaforma che si sta utilizzando. Pertanto, i calcoli che coinvolgono dati binari potrebbero produrre risultati diversi su macchine diverse. Per le conversioni indipendenti dalla piattaforma tra stringhe esadecimali e interi, utilizzare le funzioni INTTOHEX e HEXTOINT piuttosto che la funzione CONVERT specifico per la piattaforma. Per dettagli, vedere le funzioni di conversione di tipo sezione di dati. operatori stringhe Gli operatori di concatenazione di stringhe e sia il supporto dei dati di tipo binario. La conversione esplicita di operandi binari a tipi di dati carattere non è necessario con l'operatore. conversione dei dati espliciti ed impliciti produrre risultati diversi, però. Restrizioni dati binari e VARBINARY le seguenti limitazioni si applicano alle colonne contenenti BINARY e dati VARBINARY: Non è possibile utilizzare le funzioni di aggregazione SUM. AVG. STDDEV. o contrasto con i tipi di dati binari. Le funzioni di aggregazione MIN. MAX. e COUNT non supportare i tipi di dati binari binario e VARBINARY. HNG. WD. DATA . TEMPO . e gli indici DTTM non supportano i dati binari o VARBINARY. tipi solo l'indice di default e indice CMP sono supportati per i dati VARBINARY maggiore di 255 byte di lunghezza. operazioni a bit sono supportate su BINARIO e di dati varbinary che è di 8 byte o meno di lunghezza. Compatibilità Il trattamento di zeri finali in dati binari è diverso tra Sybase IQ, SQL Anywhere, e Adaptive Enterprise Server: Tabella 3-4: Trattamento di zeri finali troncato, non imbottito Adaptive Server Enterprise, SQL Anywhere e Sybase IQ tutte supportano il database STRINGRTRUNCATION opzione, che colpisce messaggio di errore di segnalazione quando una stringa INSERT o UPDATE viene troncato. Per Transact-SQL confronti di stringhe compatibile, impostare l'opzione STRINGRTRUNCATION per lo stesso valore in entrambi i database. È anche possibile impostare l'opzione STRINGRTRUNCATION ON durante il caricamento di dati in una tabella, per avvisare l'utente che i dati è troppo grande per caricare nel campo. Il valore di default è ON. operazioni di Bit sui dati di tipo binari non sono supportate da Adaptive Server Enterprise. SQL Anywhere supporta solo le operazioni di bit contro i primi quattro byte di dati di tipo binario. Sybase IQ supporta le operazioni bit contro i primi otto byte di dati di tipo binario. UNIQUEIDENTIFIER utilizzati per lo stoccaggio di UUID (noto anche come GUID) valori. Il tipo di dati UNIQUEIDENTIFIER viene spesso utilizzato per una chiave primaria o altra colonna unica di tenere UUID (Universally Unique Identifier) ​​valori che possono essere utilizzati per identificare in modo univoco le righe. La funzione NEWID genera valori UUID in modo tale che un valore prodotto su un computer non corrisponde un UUID prodotta su un altro computer. I valori uniqueidentifier generati utilizzando NEWID possono quindi essere utilizzati come chiavi in ​​un ambiente di sincronizzazione. Ad esempio, la seguente istruzione aggiorna la mytab tavolo e imposta il valore della uidcol colonna a un identificatore univoco generato dalla funzione NEWID, se il valore corrente della colonna è NULL. Se si esegue la seguente dichiarazione, l'identificatore univoco viene restituito come un binario (16). Ad esempio, il valore potrebbe essere 0xd3749fe09cf446e399913bc6434f1f08. È possibile convertire questa stringa in un formato leggibile utilizzando la funzione UUIDTOSTR (). I valori UUID sono anche denominati come GUID (Globally Unique Identifier). Le funzioni STRTOUUID e UUIDTOSTR vengono utilizzati per convertire valori compresi tra UNIQUEIDENTIFIER e rappresentazioni di stringa. I valori uniqueidentifier vengono memorizzati e restituiti come BINARIO (16). Poiché i valori uniqueidentifier sono grandi, utilizzando BIGINT UNSIGNED o colonne INT identità UNSIGNED invece di UNIQUEIDENTIFIER è più efficiente, se non hai bisogno di database croce identificatori univoci. Norme e compatibilità per UNIQUEIDENTIFIER SQL92 estensione del fornitore. Sybase Supportato da SQL Anywhere. Non supportato da Adaptive Server Enterprise. Compatibilità Nel database creati prima di Sybase IQ versione 12.7, il STRTOUUID. UUIDTOSTR. e le funzioni di NEWID sono stati sostenuti attraverso CIS compensazione funzionale. Nelle versioni 15.1 e successive, il STRTOUUID. UUIDTOSTR. e le funzioni di NEWID sono native funzioni Sybase IQ. Per ulteriori informazioni relative a UNIQUEIDENTIFIER: LOAD TABLE DATETIME (hh MMDDYY: mm: SSAA) Sybase IQ è dotato di ottimizzazioni carico per data comune, l'ora e formati datetime. Se i dati da caricare partite uno di questi formati, è possibile ridurre in modo significativo il tempo di caricamento utilizzando il formato appropriato. Per un elenco di questi formati, e dettagli sulle ottimizzare le prestazioni durante il caricamento di data e datetime dati, vedere il Capitolo 7, Spostamento di dati dentro e fuori del database nella Guida per l'amministratore di sistema Sybase IQ. È inoltre possibile specificare il campo datetime come un ASCII campo a larghezza fissa (come descritto sopra) e utilizzare la (1) possibilità di saltare il delimitatore di colonna FILLER. Per ulteriori informazioni sulla specifica data e ora, vedere i tipi di dati di data e ora o il Capitolo 7, Spostamento di dati dentro e fuori del database nella Guida per l'amministratore di sistema Sybase IQ. La porzione NULL della colonna-spec indica come trattare certi valori di input come valori NULL durante il caricamento nella colonna della tabella. Questi caratteri possono includere spazi, zeri, o di qualsiasi altra lista di letterali si definisce. Quando si specifica un valore NULL o la lettura di un valore NULL dal file di origine, la colonna di destinazione deve essere in grado di contenere NULL. ZEROS sono interpretati come segue: la cella è impostato su NULL se (e solo se) i dati di ingresso (prima della conversione, se ASCII) è tutti zeri binari (e non zeri carattere). Se i dati di ingresso è il carattere zero, allora: NULL (zeri) non causa la cellula sia NULL. NULL (0) induce la cellula ad essere NULL. Se i dati di input è zero binario (tutti i bit chiari), allora: NULL (zeri) induce la cellula ad essere NULL. NULL (0) non causa la cellula sia NULL. Ad esempio, se l'istruzione LOAD include col1 data (AAMMGG) nulli (zero) e la data è 000000, viene visualizzato un errore che indica che 000000 non può essere convertito in una data (4). Per ottenere il carico di inserire un valore NULL in col1 quando i dati sono 000000, scrivere la clausola NULL come null (000000). o modificare i dati di parità zeri binari e utilizzare NULL (zeri). Se la lunghezza di una cella VARCHAR è zero e la cella non è NULL, si ottiene una cella di lunghezza zero. Per tutti gli altri tipi di dati, se la lunghezza della cella è zero, Sybase IQ inserisce un NULL. Questo è un comportamento ANSI. Per il trattamento non ANSI dei dati di carattere di lunghezza zero, impostare l'opzione di database NonAnsiNullVarchar. Un'altra parte importante del carico-specifica è l'opzione FILLER. Esso indica che si vuole saltare su un campo specificato nel file di input di origine. Ad esempio, ci possono essere caratteri alla fine di righe o addirittura interi campi nei file di input che non si desidera aggiungere alla tabella. Come per la definizione della colonna-spec, FILLER consente di specificare ASCII lunghezza fissa di byte, caratteri di lunghezza variabile delimitati da un separatore, e campi binari utilizzando byte prefisso. il nome del file-string Il nome del file-stringa viene passato al server come una stringa. La stringa è quindi soggetta agli stessi requisiti di formattazione delle altre stringhe SQL. In particolare: Per indicare percorsi di directory nei sistemi Windows, il carattere backslash deve essere rappresentato da due barre rovesciate. Pertanto, la dichiarazione per caricare i dati dal file C: tempinput. dat nella tabella dipendente è: Il nome del percorso è relativo al server di database, non l'applicazione client. Se si esegue la dichiarazione su un server di database su qualche altro computer, i nomi delle directory si riferisce alla directory sul computer server, non sul computer client. Quanto segue descrive ciascuna delle clausole della dichiarazione: PAROLA SKIP consente il carico di continuare, quando si lavora con dati più lungo del limite specificato quando l'indice di parola è stato creato. Se una riga non viene caricato perché una parola supera la dimensione massima consentita, un avviso viene scritto nel file. iqmsg. violazioni dimensione della parola possono essere opzionalmente registrati nel file messaggio di log e ha respinto le righe registrati nel file di riga del log specificato nella dichiarazione LOAD TABLE. Se l'opzione non è specificata, LOAD tabella riporta un errore e tira indietro la prima occorrenza di una parola che è più lungo del limite specificato. numero specifica il numero di volte in cui le parole che superano la lunghezza massima consentita parola non supportato errore viene ignorato. 0 (zero) significa che non c'è alcun limite. CITAZIONI Questo parametro è facoltativo e il valore predefinito è ON. Con le citazioni accesi, CARICO TABELLA aspetta stringhe di input per essere racchiuse tra virgolette. Il carattere preventivo è o un apostrofo (virgoletta singola) o un segno di virgolette (virgolette). Il primo di questi personaggio incontrato in una stringa viene trattato come il carattere preventivo per la stringa. dati stringa devono essere terminati con una citazione di corrispondenza. Con Citazioni su. caratteri colonna o delimitatore di riga possono essere inclusi nel valore della colonna. virgolette iniziali e finali si presume di non essere parte del valore e sono esclusi dal valore dei dati caricati. Per includere un carattere preventivo in un valore con quotazioni su. utilizzare due virgolette. Ad esempio, la riga seguente include un valore nella terza colonna che è un singolo carattere preventivo: con la striscia attiva (impostazione predefinita), gli spazi finali vengono rimossi dai valori prima di essere inseriti. Gli spazi finali vengono rimossi solo per le stringhe non quotate. stringhe tra virgolette mantengono i loro spazi finali. I principali caratteri vuoti o TAB vengono tagliati solo quando l'impostazione QUOTAZIONI è ON. L'impianto di estrazione dei dati fornisce opzioni per la gestione preventivi (TEMPEXTRACTQUOTES. TEMPEXTRACTQUOTESALL. E TEMPEXTRACTQUOTE). Se si prevede di caricare di nuovo il file estratto con campi stringa che contengono colonna o delimitatore di riga sotto l'estrazione di default ASCII, utilizzare l'opzione TEMPEXTRACTBINARY per l'estratto e il formato binario e citazioni OFF opzioni per LOAD TABLE. Le quotazioni su opzione si applica solo ai campi ASCII delle colonne delimitati. Con Citazioni su. il primo carattere di un delimitatore di colonna o riga di terminazione non può essere un segno di singolo o doppio preventivo. L'opzione CITAZIONI non è valida per il caricamento di oggetto binario di grandi dimensioni (BLOB) o dati carattere oggetto di grandi dimensioni (CLOB) dal file secondario, indipendentemente dalla sua impostazione, Una citazione iniziale o finale viene caricato come parte dei dati CLOB. Due citazioni consecutivi tra virgolette che racchiudono vengono caricati come due citazioni consecutivi con le quotazioni su opzione. Adaptive Server Enterprise BCP non supporta l'opzione virgolette. Tutti i dati di campo viene copiato dentro o fuori equivalente le quotazioni OFF di impostazione. Come Citazioni su è l'impostazione predefinita per l'istruzione IQ LOAD TABLE Sybase, è necessario specificare CITAZIONI OFF durante l'importazione dei dati ASE dall'uscita BCP per un tavolo IQ Sybase. Se il carico TABELLA incontra tutti i caratteri non bianchi dopo il carattere preventivo finale per un campo chiuso, il seguente errore viene segnalato e l'operazione di caricamento viene eseguito il rollback: il testo non-spazio trovato dopo la fine carattere preventivo per un campo chiuso. SQLSTATE: QTA14 SQLCODE: -1005014L Con Citazioni su. se un preventivo singola o doppia è specificato come il primo carattere del delimitatore di colonna, viene segnalato un errore e l'operazione di caricamento non riesce: marchio singola o doppia citazione non può essere il 1 ° carattere del delimitatore di colonna o riga di terminazione con l'opzione quotazioni su. SQLSTATE: QCA90 SQLCODE: -1013090L vincoli CHECK Questa opzione di default su ON. Quando si specifica VEDI GLI OSTACOLI. controllare i vincoli vengono valutati e si è liberi di ignorare o di log. Impostazione vincoli CHECK provoca OFF Sybase IQ di ignorare tutte le violazioni dei vincoli di controllo. Questo può essere utile, per esempio, durante la ricostruzione del database. Se una tabella ha controllare i vincoli che chiamano funzioni definite dall'utente che non sono ancora creati, la ricostruzione non riesce a meno che questa opzione è impostata su OFF. Questa opzione è mutuamente esclusivo alle seguenti opzioni. Se una di queste opzioni sono specificati nello stesso carico, si verifica un errore: ignorare VINCOLO ALL IGNORA vincolo di controllo DEFAULT Se l'opzione DEFAULT è attivata (impostazione predefinita) e la colonna ha un valore predefinito, tale valore viene utilizzato. Se l'opzione DEFAULT è OFF, qualsiasi colonna non presente nell'elenco di colonne viene assegnato NULL. L'impostazione per l'opzione DEFAULT si applica a tutti i valori della colonna di default, tra cui AUTOINCREMENT. Per informazioni dettagliate sull'utilizzo dei valori di default delle colonne con carichi e inserti, vedere Utilizzo di default delle colonne nel capitolo 9, Garantire l'integrità dei dati nella Guida per l'amministratore di sistema Sybase IQ. FUGHE Se si omette una definizione di colonna-spec per un campo di input e fughe è attivata (impostazione predefinita), caratteri che seguono il carattere di backslash sono riconosciuti e interpretati come caratteri speciali da parte del server di database. caratteri di nuova riga possono essere inclusi come la combinazione n, altri personaggi possono essere inclusi nei dati come codici ASCII esadecimali, come x09 per il carattere tab. Una sequenza di due caratteri barra rovesciata () viene interpretata come una singola barra rovesciata. Per Sybase IQ, è necessario impostare questa opzione. FORMATO Sybase IQ supporta ASCII e campi di input binari. Il formato è generalmente definito dalla colonna-spec sopra descritto. Se si omette tale definizione per una colonna, per default Sybase IQ utilizza il formato definito da questa opzione. linee di ingresso si presume di avere ascii (impostazione predefinita) o campi binari, una riga per riga, con valori separati dal carattere delimitatore di colonna. Delimitato da Se si omette un delimitatore di colonna nella definizione della colonna-spec, il carattere predefinito delimitatore di colonna è una virgola. È possibile specificare un delimitatore di colonna alternativa, fornendo un singolo carattere ASCII o la rappresentazione carattere esadecimale. Il delimitata da clausola è la seguente: Per utilizzare il carattere di nuova riga come delimitatore, è possibile specificare la combinazione speciale n o il suo x0a valore ASCII. Anche se è possibile specificare fino a quattro caratteri nel delimitatore di stringa colonna-spec. è possibile specificare solo un singolo carattere nella delimitato da clausola di striscia con STRISCIA attivata (impostazione predefinita), gli spazi vengono rimossi dai valori di uscita prima di essere inseriti. Questo è efficace solo per i dati VARCHAR non si applica a ASCII inserti fix-larghezza. Per attivare l'opzione spogliano, la clausola è la seguente: Gli spazi finali vengono rimossi solo per le stringhe nonquoted. stringhe tra virgolette mantengono i loro spazi finali. In alternativa, l'opzione RIEMPIMENTO consente di essere più preciso nel numero di byte di spogliare invece di tutti gli spazi finali. È più efficiente per Sybase IQ per avere questa opzione, e aderisce allo standard ANSI quando si tratta di spazi finali. (Dati char è sempre riempita, quindi questa opzione ha effetto solo dati varchar.) Con Checkpoint L'impostazione di default è OFF. Se impostato su ON, un posto di blocco viene rilasciato dopo aver completato la registrazione e la dichiarazione con successo. Se con Checkpoint ON non è specificato, e il recupero è successivamente richiesto, il file di dati utilizzato per caricare la tabella è necessaria per il recupero di completare con successo. Se con Checkpoint ON è specificata, e il recupero è successivamente richiesto, inizia dopo il checkpoint, e il file di dati non deve essere presente. BLOCCO FATTORE Specifica il blocco fattore, o il numero di record per blocco utilizzato quando un nastro è stato creato. Questa opzione non è valida per gli inserti da campi di input di lunghezza variabile utilizzare l'opzione BLOCKSIZE invece. Tuttavia, lo fa effetto su tutti gli inserti di file (anche da disco) con campi di input di lunghezza fissa, e può influenzare notevolmente le prestazioni. Non è possibile specificare questa opzione insieme con l'opzione Block Size. Il valore predefinito è 10.000. BLOCK SIZE Specifica la dimensione predefinita in byte in cui ingresso deve essere letta. Questa opzione riguarda solo i dati di input di lunghezza variabile letti dal file non è valida per i campi di input di lunghezza fissa. E 'simile a BLOCCARE FACTOR. ma non ci sono restrizioni sul rapporto di formato dei record per bloccare dimensioni. Non è possibile specificare questa opzione insieme all'opzione BLOCCO FACTOR. Il valore predefinito è 500.000. Byte Order Specifica l'ordine dei byte legge durante. Questa opzione si applica a tutti i campi di input binari. Se nessuno sono definiti, questa opzione viene ignorata. Sybase IQ legge sempre i dati binari nel formato nativo per la macchina è in esecuzione su (di default è nativo). È inoltre possibile specificare: alto quando le quantità più byte hanno il byte di ordine alto prima (per le grandi piattaforme endian come Sun, IBM AIX e HP). LOW quando le quantità più byte hanno il byte di ordine basso prima (per le piattaforme little endian come Windows). LIMIT Specifica il numero massimo di righe da inserire nella tabella. Il valore di default è 0 per nessun limite. Il massimo è 2 GB - 1. NOTIFY Specifica che si notifica con un messaggio ogni volta che il numero specificato di righe viene inserito correttamente nella tabella. L'impostazione predefinita è ogni 100.000 righe. Il valore di questa opzione sostituisce il valore dell'opzione di database NOTIFYMODULUS. SU FILE ERROR Specifica l'azione Sybase IQ prende quando un file di input non può essere aperto perché non esiste o si dispone di autorizzazioni non corrette per leggere il file. È possibile specificare una delle seguenti opzioni: ROLLBACK annulla l'intera transazione (il default). FINITURA termina le inserzioni già completate e si conclude l'operazione di caricamento. CONTINUA restituisce un errore, ma salta solo il file per continuare l'operazione di caricamento. Non è possibile utilizzare questa opzione con inserti parziale larghezza. è consentito un solo ON clausola di errore di file. Anteprima Visualizza il layout di ingresso nella tabella di destinazione compresa la posizione, il nome e il tipo di dati di ogni colonna di partenza. Sybase IQ visualizza queste informazioni all'inizio del processo di caricamento. Se si sta scrivendo un file di log, questa informazione è anche incluso nel registro. Questa opzione è particolarmente utile con inserti parziale larghezza. ROW delimitata da specificare una stringa fino a 4 byte di lunghezza che indica la fine di un record di input. È possibile utilizzare questa opzione solo se tutti i campi all'interno della fila sono uno dei seguenti: delimitato con terminatori colonna di dati definiti dai campi a lunghezza fissa date o datetime opzioni colonna-spec ASCII Non è possibile utilizzare questa opzione se tutti i campi di input contengono dati binari. Con questa opzione, una terminazione della riga fa sì che eventuali campi mancanti da impostare a NULL. Tutte le righe devono avere le stesse delimitatori di fila, e deve essere distinto da tutti delimitatori di colonna. Le stringhe delimitatori di riga e di campo non può essere un sottoinsieme iniziale di ogni altro. Ad esempio, non è possibile specificare come delimitatore di campo e come delimitatore fila, ma è possibile specificare come delimitatore di campo con quella delimitatore di riga. Se una riga manca suoi delimitatori, Sybase IQ restituisce un errore e tira indietro l'intera transazione carico. L'unica eccezione è il record finale di un file in cui rotola indietro la riga e restituisce un messaggio di avviso. Su Windows, un delimitatore di riga viene di solito indicata dal carattere di nuova riga seguito dal carattere di ritorno a capo. Potrebbe essere necessario specificare questa come delimitatore-stringa (vedi sopra per la descrizione) sia per questa opzione o riempitivo. SALTA Consente di definire un numero di righe per saltare all'inizio delle tabelle di input per questo carico. Il valore predefinito è 0. Inizia la riga ID Specifica il numero di identificazione record di una riga nella tabella IQ Sybase dove dovrebbe iniziare l'inserimento. Questa opzione viene utilizzata per inserti parziali larghezza, che sono inserti in un sottoinsieme delle colonne della tabella. Per default, nuove righe vengono inserite ovunque ci sia spazio nella tabella, e ogni inserto inizia una nuova riga. Inserti parziale larghezza bisogno di iniziare ad una riga esistente. Hanno anche bisogno di inserire i dati dal file di origine nella tabella di destinazione posizionale per colonna, quindi è necessario specificare le colonne di destinazione nello stesso ordine in cui le loro colonne di origine corrispondenti. Definire il formato di ogni colonna di input con una colonna-spec. Il valore di default è 0. Per ulteriori informazioni su inserti parziali larghezza vedere il Capitolo 7, Spostamento di dati dentro e fuori del database nella Guida per l'amministratore di sistema Sybase IQ. Utilizzare l'opzione ID Inizia la riga solo per gli inserti parziale larghezza. Se le colonne corso di caricamento già contengono dati, l'inserimento non riesce. FORMATO SCARICO Specifica che il file ha Sybase IQ formati scaricamento interno per ogni colonna creato da una versione precedente di Sybase IQ (prima versione 12.0). Questa opzione di carico ha le seguenti restrizioni: non è possibile specificare una colonna-spec (come ASCII o prefisso) per una colonna diversa binario. Questo include le specifiche NULL. Se è necessario caricare i valori null per una colonna utilizzando il file binario di colonna-spec. è necessario specificare il NULL BYTE parola chiave CON o Sybase IQ restituisce un errore. Non è possibile utilizzare il delimitato da riga o delimitato da opzioni con FORMAT SCARICO. SU PARZIALE riga di input Specifica l'azione da intraprendere quando si incontra una fila di ingresso parziale durante un carico. È possibile specificare uno dei seguenti: CONTINUA emette un avviso e continua l'operazione di caricamento. Questa è l'impostazione predefinita. ROLLBACK interrompe l'intera operazione di caricamento e segnala l'errore. record di input parziale saltato a EOF. SQLSTATE: QDC32 SQLSTATE: -1000232L IGNORA VINCOLO specificare se ignorare CONTROLLO, unico, NULL, Dati valore e chiave esterna violazioni dei vincoli di integrità che si verificano durante un carico e il numero massimo di violazioni da ignorare prima di iniziare un rollback. Specificando ogni ConstraintType ha il seguente risultato: Mostra limite Se limite specifica pari a zero, il numero di violazioni vincolo univoco di ignorare è infinita. Se il controllo non è specificato, la prima occorrenza di qualsiasi violazione vincolo CHECK fa sì che la dichiarazione LOAD per ripristinare. Se il limite è diverso da zero, allora il limite 1 verificarsi di una violazione vincolo CHECK fa sì che il carico di rollback. limite unico se limite specifica pari a zero, allora il numero di violazioni vincolo univoco di ignorare è infinito. Se il limite è diverso da zero, allora il limite 1 verificarsi di una violazione del vincolo UNIQUE fa sì che il carico di rollback. limite NULL Se limite specifica pari a zero, allora il numero di violazioni di vincoli NULL ignorare è infinito. Se il limite è diverso da zero, allora il limite 1 verificarsi di una violazione del vincolo NULL fa sì che il carico di rollback. limite FOREIGN KEY Se limite specifica pari a zero, il numero di stranieri violazioni vincolo di chiave di ignorare è infinito. Se il limite è diverso da zero, allora il limite 1 verificarsi di una violazione del vincolo FOREIGN KEY fa sì che il carico di rollback. limite di dati VALORE Se l'opzione di database CONVERSIONERROR ON, un errore viene segnalato e l'istruzione rollback. Se limite specifica pari a zero, allora il numero di violazioni di vincoli dati di valore (errori di conversione di tipi di dati) per ignorare è infinito. Se il limite è diverso da zero, allora il limite 1 verificarsi di una violazione del vincolo DATI VALORE fa sì che il carico di rollback. ALL limite Se l'opzione di database CONVERSIONERROR ON. viene segnalato un errore e l'istruzione rollback. Se limite specifica zero, allora il totale cumulativo di tutte le violazioni dei vincoli di integrità di ignorare è infinito. Se il limite è diverso da zero, quindi caricare tira indietro quando il totale cumulativo di tutti unici ignorato, NULL, Dati valore e chiave esterna violazioni dei vincoli di integrità supera il valore di limite. Ad esempio, si specifica la seguente opzione Ignora VINCOLO: Il numero totale di violazioni dei vincoli di integrità non può superare i 200, mentre il numero totale di NULL e violazioni vincolo univoco non può superare i 50 e 100, rispettivamente. Ogni volta che uno di questi limiti viene superato, la dichiarazione LOAD TABLE rollback. Una singola riga può avere più di una integrità violazione del vincolo. Ogni verificarsi di una violazione di vincolo di integrità conta verso il limite di quel tipo di violazione. Sybase fortemente consiglia di impostare Ignora limite possibilità di vincolo per un valore diverso da zero se si registrano le violazioni dei vincoli di integrità ignorati. Logging un numero eccessivo di violazioni influisce sulle prestazioni del carico. Se la verifica, unico, NULL, o FOREIGN KEY non è specificato nella clausola IGNORE CONSTRAINT, quindi il carico rotola indietro sulla prima occorrenza di ciascuno di questi tipi di violazione del vincolo di integrità. Se il valore dati non sono specificate nella clausola IGNORE CONSTRAINT, quindi il carico rotola indietro sulla prima occorrenza di questo tipo di violazione del vincolo di integrità, a meno che l'opzione di database CONVERSIONERROR OFF. Se CONVERSIONERROR OFF. un avvertimento è segnalato per qualsiasi violazione di vincolo DATA VALUE e il carico continua. Quando il carico completato, un messaggio informativo per quanto riguarda l'integrità violazioni vincolo è registrato nel file. iqmsg. Questo messaggio contiene il numero di violazioni dei vincoli di integrità che si sono verificati durante il carico e il numero di righe che sono stati ignorati. Messaggio di log Specifica i nomi dei file in cui registrare le informazioni relative violazioni dei vincoli di integrità e le tipologie di violazioni da registrare. Timestamp che indica l'inizio e il completamento del carico vengono registrati sia nel registro dei messaggi ei file riga del log. Sia log dei messaggi e LOG ROW devono essere specificati, o nessuna informazione su violazioni di integrità viene registrato. Se la clausola di log solo non è specificato, nessuna informazione sulle violazioni dei vincoli di integrità viene registrato. Solo i timestamp che indica l'inizio e il completamento del carico vengono registrati. Le informazioni vengono registrate su tutte le violazioni dell'integrità vincolo di tipo specificate nella clausola di log solo o per tutti parola violazioni indice di lunghezza se viene specificata la parola chiave PAROLA. Se violazioni di vincoli vengono registrati, ogni occorrenza di una violazione di vincolo di integrità genera esattamente una riga di informazioni nel file di messaggio di log. Il numero di righe (errori segnalati) nel file di log dei messaggi può superare il limite di opzione Ignora VINCOLO, perché il carico viene eseguita da più thread in esecuzione in parallelo. Più di un thread potrebbe segnalare che il numero di violazioni dei vincoli ha superato il limite specificato. Se violazioni di vincoli vengono registrati, esattamente una riga di informazioni vengono registrate nel file riga del log per una determinata riga, indipendentemente dal numero di violazioni dei vincoli di integrità che si verificano in quella riga. Il numero di errori distinti nel file messaggio di log potrebbe non corrispondere esattamente al numero di righe nel file di LOG ROW. La differenza nel numero di righe è dovuta alla elaborazione parallela del carico sopra descritto per il LOG MESSAGE. I file di registro messaggio di log e riga non possono essere partizioni prime. Se il file messaggio di log o REGISTRO riga esiste già, le nuove informazioni viene aggiunto al file. Specifica di un nome di file non valido per il file messaggio di log o REGISTRO ROW genera un errore. Specificando lo stesso nome di file per i file di messaggio di log e di registro ROW genera un errore. Varie combinazioni di Ignora opzioni di vincolo e log dei messaggi si traducono in diverse azioni di registrazione, come indicato nella tabella 6-11. Tabella 6-11: CARICO azioni di registrazione TABELLA IGNORE vincolo specificato nulla viene registrato. La prima violazione del vincolo di integrità provoca un rollback. Sybase fortemente consiglia di impostare Ignora limite possibilità di vincolo per un valore diverso da zero, se si registrano le violazioni dei vincoli di integrità ignorati. Se una singola riga ha più di una violazione del vincolo di integrità, una riga per ogni violazione viene scritto nel file messaggio di log. Logging un numero eccessivo di violazioni influisce sulle prestazioni del carico. LOG delimitato da Specifica il separatore tra i valori dei dati nel file di LOG ROW. Il separatore predefinito è una virgola. Gli effetti collaterali SQL92 estensione del fornitore. Sybase Non applicabile. Le autorizzazioni le autorizzazioni necessarie per eseguire un'istruzione LOAD TABLE dipenderà opzione riga di comando del server di database - GL, come segue: Se l'opzione - GL è impostata su ALL, è necessario essere il proprietario della tabella, avere l'autorità DBA, o hanno ALTER autorizzazione. Se l'opzione è impostata su - GL DBA, è necessario avere l'autorità DBA. Se l'opzione - GL è impostato su NONE, LOAD TABLE non è permesso. CARICO TABELLA richiede anche un blocco esclusivo sulle table. Chapter 7: Spostamento di dati dentro e fuori del database dei dati di carico alla rinfusa utilizzando l'istruzione LOAD TABLE L'istruzione LOAD TABLE viene utilizzato per un efficiente importazione di dati da un file di testo o binari in un database esistente tavolo. Carica i dati in tutti gli indici delle colonne che avete definito, così come qualsiasi creato automaticamente. Le autorizzazioni necessarie per eseguire un'istruzione LOAD TABLE sono impostate sulla riga di comando del server, utilizzando l'opzione - GL. Sybase raccomanda l'-GL tutte le impostazioni, che permette a qualsiasi utente di caricare o scaricare un tavolo. Questa è l'impostazione di default impostato dal startasiq. Se l'opzione - GL è impostata su ALL, è necessario essere il proprietario della tabella, avere l'autorità DBA, o avere l'autorizzazione ALTER, al fine di utilizzare l'istruzione LOAD TABLE. È inoltre necessario il permesso INSERT sul tavolo. Vedere la descrizione dell'opzione carico ERRORE SU FILE per ciò che accade quando gli errori di file di input si verificano durante un carico. Utilizzando i file di comando per caricare i dati Per caricare grandi quantità di dati, la maggior parte degli utenti di creare i file di comando. Per creare un file di comando, seguire le istruzioni riportate nel capitolo Introduzione a DBISQL nella Introduzione a Sybase IQ. l'elaborazione delle transazioni e LOAD tabella Quando si esegue l'istruzione LOAD TABLE per una tabella IQ, un punto di salvataggio avviene automaticamente prima i dati vengono caricati. Se il carico viene completata correttamente, Sybase IQ rilascia il punto di salvataggio. If the load fails, the transaction rolls back to the savepoint. This approach gives you flexibility in committing transactions. For example, if you issue two LOAD TABLE commands, you can ensure that either both commit or neither. When you issue LOAD TABLE for a Catalog Store table, there is no automatic savepoint. If the load succeeds, it commits automatically. If the load fails, it rolls back. You cannot roll back a successful load of a Catalog Store table. Integrity constraints and LOAD TABLE LOAD TABLE allows you to control load behavior when integrity constraints are violated and to selectively log information about the violations. You can specify whether to ignore UNIQUE, NULL, DATA VALUE, andor FOREIGN KEY constraint violations that occur during a load and the maximum number of violations to ignore before initiating a rollback. You can also direct the load to log information about specific types of integrity constraint violations both per violation in a message log and per row in a row log. For information on the contents and format of the message and row logs, see Logging integrity constraint violations . Summary of LOAD TABLE syntax The basic form of the LOAD TABLE statement is: For usage and syntax details of all of the LOAD TABLE parameters, see LOAD TABLE statement in Chapter 6, SQL Statements of the Sybase IQ Reference Manual . Load specification The load-specification does the following: Lists each column to be loaded and describes the data in it. A column can contain fixed-length data, variable-length characters delimited by a separator, or data that uses a binary prefix to represent the number of bytes being read. Specifies FILLER format for any fields you want to skip. The syntax for load-specification is as follows: For each column, you can specify a column-spec . If you omit this option, the format information in the load-options applies to this column. The column-spec and load-options format information tell Sybase IQ what type of data to expect, and how to convert it into a compatible data format if necessary. Syntax for the column-spec is: You can specify the following types of data in the column-spec : Data with bytes of fixed length. Although specified by the keyword ASCII, any 8-bit characters may be used, and for 16-bit character sets, two 8-bit characters are used for each 16-bit character. No code conversion is performed for char and varchar fields except truncation, blank stripping, or blank padding. ASCII is also used to fill numeric data, time, and datetime fields. In each case, the conversion is the same if the value were first inserted as a character field, then cast to the data type of the column in the table. The input-width value is an integer value indicating the fixed width in bytes of the input field in every record. Binary fields that use a number of PREFIX bytes (1, 2, or 4) to specify the length of the binary input. The BINARY keyword indicates that data is already converted to the internal form (except for when the byte-order load option is specified. Note that if the data is unloaded using the extraction facility with the TEMPEXTRACTBINARY option set ON, then you must use the BINARY WITH NULL BYTE parameter for each column when you load the binary data. Variable-length characters delimited by a separator. You specify the delimiter-string as a string of one to four ASCII characters, or any 8bit hexadecimal ASCII code that represents a single, non-printing character. The delimiter-string must be enclosed in single quotes. For example, you specify: x09 to represent a tab as the terminator. x00 for a null terminator (no visible terminator as in C strings). x0a for a newline character as the terminator. You can also use the special character combination of n for newline. DATE or DATETIME string as ASCII characters. You must define the input-date-format or input-datetime-format of the string using one of the corresponding formats for the date and datetime data types supported by Sybase IQ. Use DATE for date values and DATETIME for datetime and time values. For information about these data types, see the Sybase IQ Reference Manual . The column-spec is for IQ tables only. If you specify a column-spec for a Catalog Store table, you get an error. The NULL portion of the column-spec indicates how to treat certain input values as NULL values when loading into the table column. These characters can include BLANKS, ZEROS, or any other list of literals you define. When you specify a NULL value or read a NULL value from the source file, the destination column must be able to contain NULLs. ZEROS are interpreted as follows: the cell is set to NULL if (and only if) the input data (before conversion, if ASCII) is all binary zeros (and not character zeros). If the input data is character zero, then: a) NULL(ZEROS) never causes the cell to be NULL b) NULL(0) causes the cell to be NULL If the input data is binary zero (all bits clear), then: a) NULL(ZEROS) causes the cell to be NULL b) NULL(0) never causes the cell to be NULL For example, if your LOAD statement includes col1 date(yymmdd) null(zeros) and the date is 000000, you will receive an error indicating that 000000 cannot be converted to a DATE(4). To get the load statement to insert a NULL value in col1 when the data is 000000, you must write the NULL clause as null(000000). or modify the data to equal binary zeros and use NULL(ZEROS). The FILLER clause indicates you want to skip over a specified field in the source input file. For example, there may be characters at the end of rows or even entire fields in the input files that you do not want to add to the table. As with the column-spec definition, FILLER allows you to specify ASCII fixed length of bytes, variable length characters delimited by a separator, and binary fields using PREFIX bytes. The maximum length of a variable-length FILLER column is 512 bytes. FILLER clause syntax is as follows: For more information on how to use data conversion options, see Converting data on insertion . Specifying files to load You specify one or more files from which to load data. In the FROM clause, you specify each filename-string . and separate multiple strings by commas. The files are read one at a time, and processed in a left-to-right order as specified in the FROM clause. Any SKIP or LIMIT value only applies in the beginning of the load, not for each file. If a load cannot complete, for example due to insufficient memory, the entire load transaction is rolled back. filename-string The filename-string is passed to the server as a string. The string is therefore subject to the same formatting requirements as other SQL strings. In particular: If a backslash () precedes the characters n. X. or it is considered an escape character. For this reason, to indicate directory paths in Windows systems, you must represent the backslash character by two backslashes if the next character is any of those listed. (It is always safe to double the backslashes.) Therefore, the statement to load data from the file c:newinput. dat into the employee table is: The pathname is relative to the database server, not to the client application. If you are running the statement on a database server on some other computer, the directory name refers to directories on the server machine, not on the client machine. The input file for the load must be on the server machine. Named pipes The file specification can be a named pipe. When you load from a named pipe (or FIFO) on Windows, the program writing to the pipe must close the pipe in a special way. The pipe writer must call FlushFileBuffers( ) and then DisconnectNamedPipe( ). (If you do not, Sybase IQ reports an exception from hosio::Read( ).) This issues a PIPENOTCONNECTED error, which notifies Sybase IQ that the pipe was shut down in an orderly manner rather than an uncontrolled disconnect. See Microsoft documentation for details on these calls. Specifying table-wide format options You can specify several options that describe the format of input data. FORMAT option You can specify a default format for table columns, which applies if you omit the column-spec . The same formats that can appear in the column-spec can appear here. If you also omit the FORMAT load option, the file is assumed to be binary. DELIMITED BY option If you omit a column delimiter in the column-spec definition, the default column delimiter character is a comma. You can specify an alternative column delimiter by providing a single ASCII character or the hexadecimal representation. In particular, to specify tab-delimited values use the hexadecimal ASCII code of the tab character (9), as follows: To use the newline character as a delimiter, you can specify either the special combination n or its ASCII value x0a. Although the delimiter-string in the column-spec may be a string of up to four characters, the DELIMITED BY option allows only a single ASCII character or its hexadecimal representation. STRIP option With STRIP turned on (the default), trailing blanks are stripped from values before they are inserted. This is effective only for VARCHAR data. To turn the STRIP option off, enter the clause as follows: Trailing blanks are stripped only for non-quoted strings. Quoted strings retain their trailing blanks. If you dont require blank sensitivity, you may use the FILLER option allows you to be more specific in the number of bytes to strip instead of just all the trailing spaces. This option does not apply to ASCII fixed-width inserts. For example, the STRIP option in the following statement is ignored: QUOTES option The QUOTES parameter is optional and the default is ON . With QUOTES turned on, LOAD TABLE expects input strings to be enclosed in quote characters. The quote character is either an apostrophe (single quote) or a quotation mark (double quote). The first such character encountered in a string is treated as the quote character for the string. String data must be terminated with a matching quote. With QUOTES ON . column or row delimiter characters can be included in the column value. Leading and ending quote characters are assumed not to be part of the value and are excluded from the loaded data value. With QUOTES OFF . Sybase IQ does not strip off apostrophes (single quotes) or quotation marks (double quotes). When it encounters these characters in your input file, it treats them as part of the data. With QUOTES OFF . you cannot include column delimiter characters in column values. QUOTES option example Consider a table defined as: with the following input data: The result of loading this data is displayed by running the following query: The following output displays the result of the query enclosed by lt and gt and the values of the LOAD TABLE options QUOTES and STRIP : Notes on the results: With QUOTES ON and STRIP ON . both leading space and trailing space for the non-enclosed field c2 row 1 are trimmed. With QUOTES ON and STRIP OFF . only the leading space for the non-enclosed field c2 row 1 is trimmed. With QUOTES OFF and STRIP ON . only the trailing space for the non-enclosed field c2 row 1 is trimmed. With QUOTES OFF and STRIP OFF . neither leading space nor trailing space for the non-enclosed field c2 row 1 is trimmed. With QUOTES ON and STRIP ON . both leading space and trailing space within quotes for the enclosed fields c2 and c3 row 3 are NOT trimmed. ESCAPES option Currently, you must specify ESCAPES OFF . The default of ESCAPES ON is provided for compatibility with Adaptive Server Anywhere this option may be supported in a future version. With ESCAPES turned on, if you omit a column-spec definition for an input field, characters following the backslash character are recognized and interpreted as special characters by the database server. Newline characters can be included as the combination n, and other characters can be included in data as hexadecimal ASCII codes, such as x09 for the tab character. A sequence of two backslash characters ( ) is interpreted as a single backslash. WORD SKIP option Allows the load to continue when it encounters data longer than the limit specified when the word index was created. For details, see LOAD TABLE statement, Chapter 6, SQL Statements, in the Sybase IQ Reference Manual. The following UNIX example specifies a BLOCK FACTOR of 50,000 records along with the PREVIEW option: Specifying load options You can specify a wide range of load options. These options tell Sybase IQ how to interpret and process the input file, and what to do when errors occur. You can specify load options in any order. Syntax for load-options is as follows: The syntax for the parameters is as follows: Each of these options is described briefly below. For details of all options of the LOAD TABLE statement, see the Sybase IQ Reference Manual . BLOCK FACTOR option Specifies blocking factor, or number of records per block, used when a source was created. This option is not valid for insertions from variable length input fields use the BLOCK SIZE option instead. However, it does affect all file inserts (including from disk) with fixed length input fields, and it can affect performance dramatically. The default setting for BLOCK FACTOR is 10,000. Higher block factors generally improve the speed of IO operations. However, consider the following when setting this option: If your source is a disk file, memory considerations will determine the best setting for your system. If your source is a tape, either use the same blocking factor that was used when creating the tape (for best performance) or a blocking factor that is evenly divisible into it. Sybase IQ rejects the insert operation if you specify a BLOCK FACTOR of zero. You cannot specify BLOCK FACTOR along with BLOCK SIZE or with any variable-width input fields. If you are loading very wide varchar data, reduce the BLOCK FACTOR to 10. ESCAPE CHARACTER option Specifies an alternative escape character. The default escape character for characters stored as hexadecimal codes and symbols is a backslash (), so that x0A is the linefeed character, for example. This can be changed using the ESCAPE CHARACTER clause. For example, to use the exclamation mark as the escape character, you would enter: Only one single-byte character can be used as an escape character. Because you must specify ESCAPES OFF in this version of Sybase IQ, the ESCAPE CHARACTER option has no effect. It is provided for compatibility with Adaptive Server Anywhere. WITH CHECKPOINT ON clause If this option is set to ON . a checkpoint is issued when the LOAD TABLE statement completes and is logged. In the event recovery is required, it is guaranteed even if the data file is then removed from the system. If WITH CHECKPOINT ON is not specified, the file used for loading must be retained in case recovery is required. BLOCK SIZE option Specifies the default size in bytes in which input should be read. This option only affects variable-length input data read from files it is not valid for fixed-length input fields. It is similar to BLOCK FACTOR . but there are no restrictions on the relationship of record size to block size. You cannot specify this option along with the BLOCK FACTOR option. The default setting for BLOCK SIZE is 500,000, which is high enough for input from disk files. For tape files, you should specify the same block size that was used when creating the tape. You cannot specify BLOCK SIZE along with BLOCK FACTOR or with any fixed width input fields. The following UNIX example specifies a BLOCK SIZE of 200,000 bytes: BYTE ORDER option Specifies the byte ordering during reads. This option applies to all binary input fields, including those defined as PREFIX 2 or PREFIX 4. If none are defined, this option is ignored. Sybase IQ always reads prefix binary data in the format native to the machine it is running on (default is NATIVE ). You can also specify: HIGH when multibyte quantities have the high order byte first (for big endian platforms like Sun, IBM AIX, and HP). LOW when multibyte quantities have the low order byte first (for little endian platforms like Windows). Here is a Windows example: LIMIT option Specifies the maximum number of rows to insert into the table. The default is 0 for no limit. The maximum is 2GB-1. LIMIT works together with the SKIP option. SKIP indicates where to begin reading from the input file, and LIMIT specifies how many of those rows to insert. SKIP takes precedence over LIMIT . If you specify multiple input files, these options only affect the first file . The following table shows how these options work together: Table 7-1: SKIP and LIMIT insert options If the SKIP value is Reads 10 rows and inserts 5 rows. If the input file has only 8 rows, then zero rows are inserted. In the following Windows example, no rows are skipped and up to 1,000,000 rows are inserted. NOTIFY option Specifies that you be notified with a message each time the specified number of rows is inserted successfully into the table. The default is every 100,000 rows. Very frequent notifications can slow down your insert operation. To turn off NOTIFY entirely, set NOTIFY 0. See Interpreting notification messages for an explanation of messages. ON FILE ERROR option Specifies the action Sybase IQ takes when an input file cannot be opened, either because it does not exist or because you have incorrect permissions to read the file. For all other reasons or errors, it aborts the entire insertion. You can specify one of the following: ROLLBACK aborts the entire transaction (the default). FINISH finishes the insertions already completed and ends the load operation. CONTINUE returns an error but only skips the file to continue the load operation. You cannot use this option with partial-width inserts. PREVIEW option Displays the layout of input into the destination table including starting position, name, and data type of each column. Sybase IQ displays this information at the start of the load process. If you are writing to a log file, this information is also included in the log. This option is especially useful with partial-width inserts. It can help you diagnose failed or skewed insertions due to incompatible data types, or destination column alignment that does not match source columns. Look at the expected column data type and starting position information to determine if you need to use an insert conversion option on a column andor where and how much filler to use. PREVIEW ON helps you determine if a load is correct. It does not stop the load from occurring. ROW DELIMITED BY option Specifies a string up to 4 bytes in length that indicates the end of an input record. You can use this option only if all fields within the row are any of the following: Delimited with column terminators Data defined by the DATE or DATETIME column-spec options ASCII fixed length fields The row delimiter can be any string of from 1 to 4 8-bit codes, including any combination of printable characters, andor any 8bit hexadecimal code that represents a non-printing character. For example, you specify x09 to represent a tab as the terminator. For a null terminator (no visible terminator as in C strings), you specify x00. To use the newline character as a row delimiter, you can specify either the special combination n or its ASCII value x0a. You cannot use this option if any input fields contain binary data. With this option, a row terminator causes any missing fields to be set to NULL. All rows must have the same row delimiters, and it must be distinct from all column delimiters. The row and field delimiter strings cannot be an initial subset of each other. For example, you cannot specify as a field delimiter and as the row delimiter, but you could specify as the field delimiter with that row delimiter. If a row is missing its delimiters, Sybase IQ returns an error and rolls back the entire load transaction. The only exception is the final record of a file where it rolls back that row and returns a warning message. On Windows, a row delimiter is usually indicated by the newline character followed by the carriage return character. You may need to specify this as the delimiter-string for either this option or FILLER. The following Windows example sets the column delimiter for the lorderkey column to tab, and the row delimiter to newline (x0a) followed by carriage return (x0d): SKIP option Lets you define a number of rows to skip at the beginning of the input file(s) for this load. The default is 0. This option works in conjunction with the LIMIT option, and takes precedence over it. In this UNIX example, Sybase IQ reads 9,000 rows from the input file, skips the first 5,000, and loads the next 4,000. If there are only 8,000 rows in the input file, then only 3,000 rows are loaded. START ROW ID option Specifies the id number of a row in the table where insertions should begin. This option is used for partial-width insertions . which insert into a subset of the columns in the table. If you are inserting data into an existing row, you must define the format of each input column with a column-spec . and use START ROW ID to identify the row where you want to insert it. The default is 0, which causes data to be inserted in a new row wherever there is space in the table. Be sure to read Partial-width insertions before using this option and performing partial-width inserts. UNLOAD FORMAT option Specifies that the data in the input file is in the format produced by the UNLOAD command in Sybase IQ 11.5.1, specifically for upgrading to Sybase IQ 12.x. This format places certain restrictions on other load options you specify: The format in the column specifications must be BINARY . the default. Specifying ASCII . PREFIX . FILLER . or string-delimiter causes an error. You must not use the load options DELIMITED BY and ROW DELIMITED BY . To allow NULLs in the data you must specify BINARY WITH NULL BYTE in the column specification. You cannot include NULL in the column-spec in any other way. For the sake of consistency with the data being loaded, you can specify BINARY WITH NULL BYTE even when loading into a table column that does not allow NULLs (as specified in CREATE TABLE or ALTER TABLE ). However, if you try to load any data into a column that does not allow NULLs, you receive an error. See the Sybase IQ Installation and Configuration Guide for more information on upgrading. ON PARTIAL INPUT ROW option Specifies the action to take when a partial input row is encountered during a load. You can specify one of the following: CONTINUE issues a warning and continues the load operation. This is the default. ROLLBACK aborts the entire load operation and reports the error IGNORE CONSTRAINT option Specifies whether to ignore UNIQUE, NULL, CHECK, DATA VALUE, andor FOREIGN KEY integrity constraint violations that occur during a load and the maximum number of violations to ignore before initiating a rollback. Specifying each constrainttype has the following result: UNIQUE limit If limit specifies zero, then the number of UNIQUE constraint violations to ignore is infinite. If limit is non-zero, then the limit 1 occurrence of a UNIQUE constraint violation causes the load to rollback. NULL limit If limit specifies zero, then the number of NULL constraint violations to ignore is infinite. If limit is non-zero, then the limit 1 occurrence of a NULL constraint violation causes the load to rollback. FOREIGN KEY limit If limit specifies zero, then the number of FOREIGN KEY constraint violations to ignore is infinite. If limit is non-zero, then the limit 1 occurrence of a FOREIGN KEY constraint violation causes the load to rollback. DATA VALUE limit If the database option CONVERSIONERROR ON, then an error is reported and the statement rolls back. If limit specifies zero, then the number of DATA VALUE constraint violations (data type conversion errors) to ignore is infinite. If limit is non-zero, then the limit 1 occurrence of a DATA VALUE constraint violation causes the load to rollback. ALL limit If the database option CONVERSIONERROR ON, then an error is reported and the statement rolls back. If limit specifies zero, then the cumulative total of all integrity constraint violations to ignore is infinite. If limit is non-zero, then load rolls back when the cumulative total of all ignored UNIQUE, NULL, DATA VALUE, and FOREIGN KEY integrity constraint violations exceeds the value of limit . For example, you specify the following IGNORE CONSTRAINT option: The total number of integrity constraint violations cannot exceed 200, while the total number of NULL and UNIQUE constraint violations cannot exceed 50 and 100, respectively. Whenever any of these limits is exceeded, the LOAD TABLE statement rolls back. A single row can have more than one integrity constraint violation. Every occurrence of an integrity constraint violation counts towards the limit of that type of violation. Sybase strongly recommends setting the IGNORE CONSTRAINT option limit to a non-zero value, if you are logging the ignored integrity constraint violations. Logging an excessive number of violations affects the performance of the load. CHECK limit If limit specifies zero, then the number of check constraint violations to ignore is infinite. If limit is non-zero, then the limit 1 occurrence of a CHECK constraint violation causes the load to roll back. A single row can have more than one integrity constraint violation. Every occurrence of an integrity constraint violation counts towards the limit of that type of violation. Sybase strongly recommends setting the IGNORE CONSTRAINT option limit to a non-zero value, if you are logging the ignored integrity constraint violations. Logging an excessive number of violations affects the performance of the load. If UNIQUE, NULL, CHECK, or FOREIGN KEY is not specified in the IGNORE CONSTRAINT clause, then the load rolls back on the first occurrence of each of these types of integrity constraint violation. If DATA VALUE is not specified in the IGNORE CONSTRAINT clause, then the load rolls back on the first occurrence of this type of integrity constraint violation, unless the database option CONVERSIONERROR OFF. If CONVERSIONERROR OFF, then a warning is reported for any DATA VALUE constraint violation and the load continues. When the load completes, an informational message regarding integrity constraint violations is logged in the. iqmsg file. This message contains the number of integrity constraint violations that occurred during the load and the number of rows that were skipped. MESSAGE LOG option Specifies the names of files in which to log information about integrity constraint violations and the types of violations to log. Timestamps indicating the start and completion of the load are logged in both the MESSAGE LOG and the ROW LOG files. Both MESSAGE LOG and ROW LOG must be specified, or no information about integrity violations is logged. If the ONLY LOG clause is not specified, then no information on integrity constraint violations is logged. Only the timestamps indicating the start and completion of the load are logged. Information is logged on all integrity constraint type violations specified in the ONLY LOG clause. If constraint violations are being logged, then every occurrence of an integrity constraint violation generates exactly one row of information in the MESSAGE LOG file. The number of rows (errors reported) in the MESSAGE LOG file can exceed the IGNORE CONSTRAINT option limit, because the load is performed by multiple threads running in parallel. More than one thread may report that the number of constraint violations has exceeded the specified limit. If constraint violations are being logged, then exactly one row of information is logged in the ROW LOG file for a given row, regardless of the number of integrity constraint violations that occur on that row. Note that the number of distinct errors in the MESSAGE LOG file may not exactly match the number of rows in the ROW LOG file. The difference in the number of rows is due to the parallel processing of the load described above for the MESSAGE LOG . The MESSAGE LOG and ROW LOG files cannot be raw partitions. If the MESSAGE LOG or ROW LOG file already exists, then new information is appended to the file. Specifying an invalid filename for the MESSAGE LOG or ROW LOG file generates an error. Specifying the same filename for the MESSAGE LOG and ROW LOG files generates an error. Various combinations of the IGNORE CONSTRAINT and MESSAGE LOG options result in different logging actions, as indicated in the following table: Nothing is logged. The first integrity constraint violation causes a rollback. Sybase strongly recommends setting the IGNORE CONSTRAINT option limit to a non-zero value, if you are logging the ignored integrity constraint violations. If a single row has more than one integrity constraint violation, a row for each violation is written to the MESSAGE LOG file. Logging an excessive number of violations affects the performance of the load. LOG DELIMITED BY option Specifies the separator between data values in the ROW LOG file. The default separator is a comma. For more details on the contents and format of the MESSAGE LOG and ROW LOG files, see Logging integrity constraint violations . LOAD TABLE adds rows The LOAD TABLE statement appends the contents of the file to the existing rows of the table it does not replace the existing rows in the table, unless you specify the START ROW ID load option. See Partial-width insertions for examples of how you use this option to insert data into existing rows. If you want to empty out an existing table and reload it, you can use the TRUNCATE TABLE statement to remove all the rows from a table. Simple LOAD TABLE example The following statement loads the data from the file dept. txt into all columns of the department table. This example assumes that no explicit data conversion is needed, and that the width of input columns matches the width of columns in the department table. Copyright 2006. Sybase Inc. All rights reserved.

No comments:

Post a Comment