Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select constant as specific type
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2000
Miscellaneous
Thread ID:
01260641
Message ID:
01260650
Views:
12
>>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
>
Thanks Borislav. Solution stars have been issued. (I feel bad I didn't think of the cast function myself)

Einar
Semper ubi sub ubi.
Previous
Reply
Map
View

Click here to load this message in the networking platform