Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select constant as specific type
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2000
Divers
Thread ID:
01260641
Message ID:
01260645
Vues:
13
This message has been marked as the solution to the initial question of the thread.
>Consider the following SELECT statement:
>
>SELECT Id,
>       0 AS MyNumber
>FROM   MyTable
>
>
>How can I make sure the MyNumber field is a specific type, e.g., tinyint or int?
>
>
>Thanks,
>Einar
SELECT Id,
       CAST(0 as int) AS MyNumber
FROM   MyTable
or
SELECT Id,
       CAST(0 as tinyint) AS MyNumber
FROM   MyTable
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform