Created
September 8, 2023 20:35
-
-
Save DaniDotExe/0b2f7f8eea3cc1fdbcc51226488e96d7 to your computer and use it in GitHub Desktop.
SQL: Ejemplos para declarar Variables de distintos Tipos de Dato y evaluar valores Nulos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @entero INT | |
SET @entero = NULL | |
SELECT ISNULL(@entero, 0) AS Valor | |
DECLARE @decimal DECIMAL(10,2) | |
SET @decimal = NULL | |
SELECT ISNULL(@decimal, 0.00) AS Valor | |
DECLARE @cadena VARCHAR(50) | |
SET @cadena = NULL | |
SELECT ISNULL(@cadena, 'Texto predeterminado') AS Valor | |
DECLARE @fecha DATETIME | |
SET @fecha = NULL | |
SELECT ISNULL(@fecha, GETDATE()) AS Valor | |
DECLARE @booleano BIT | |
SET @booleano = NULL | |
SELECT ISNULL(@booleano, 0) AS Valor | |
DECLARE @moneda MONEY | |
SET @moneda = NULL | |
SELECT ISNULL(@moneda, 0.00) AS Valor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment