SQLNotes
SQLNotes
Data Precision Integer: 0 or 1 Positive Integer 0 -> 255 Signed Integer -32,768 -> 32,767 Signed Integer -2^31 -> 2^31-1 Signed Integer -2^63 -> 2^63-1 Floating precision -1.79E + 308 -> 1.79E + 308 Floating precision -3.40E + 38 -> 3.40E + 38 4 decimal places, -2^63/10000 -> 2^63-1/10000 4 decimal places, -214,748.3648 -> 214,748.3647 Fixed precision -10^38 + 1 -> 10^38 - 1 Fixed precision -10^38 + 1 -> 10^38 - 1 Date+Time 1753-01-01 -> 9999-12-31, accuracy of 3.33 ms Fixed-length non-Unicode string to 8,000 characters Fixed-length Unicode string to 4,000 characters Variable-length non-Unicode string to 8,000 characters Variable-length Unicode string to 4,000 characters Variable-length non-Unicode string to 2,147,483,647 characters Variable-length Unicode string to 1,073,741,823 characters Fixed-length binary data up to 8,000 characters Variable-length binary data up to 8,000 characters Variable-length binary data up to 2,147,483,647 characters
GO Alterar una columna existente ALTER TABLE [dbo].[person] ALTER COLUMN [lastname] VARCHAR(35) NULL GO
Update Set
UPDATE <nombre_tabla> SET <campo1> = <valor1> {[,<campo2> = <valor2>,...,<campoN> = <valorN>]}[ WHERE <condicion>];
Buscar el conflicto de las maquinas buscar datos que hagan referencia a las maquinas pero que no esten en la tabla maquinas select * from Ent_entregas where codMaquina not in (select codMaquina from Gen_maquinas) or codMaquina is null editvaluechangebuscar si es nulo COMO CREAR UN CURSOR DECLARE @CD_EMPRESA INT,@CD_DEPTO INT,@DS_DEPTO VARCHAR(100) DECLARE C CURSOR FOR--**** SELECT CD_EMPRESA,CD_DEPTO,DS_DEPTO--CAMPOS DE LAS TALAS DEL JOIN T2.CD_BOLETIN--**** FROM MANT_DEPTOS T1--**** --JOIN WHERE CD_EMPRESA=1--**** open C--**** fetch next from C into @CD_EMPRESA,@CD_DEPTO,@DS_DEPTO--**** while @@fetch_status = 0--**** begin--****
UPDATE MANT_DEPTOS SET CD_CENTRO_COSTO=1 WHERE CD_DEPTO=5 fetch next from C into @CD_EMPRESA,@CD_DEPTO,@DS_DEPTO--**** end--**** close C--**** deallocate C--****