Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hacker Guide Question
Message
 
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00625768
Message ID:
00626057
Views:
21
Yes, it's legal. Sql Server is quite flexible in that matter. The following is legal too
Select SPACE(1) FROM mytable UNION SELECT cName FROM someothertable
The size of the result column would be equal the lenght of cName in either case.

>FWIW, this is legal to do in Oracle. I wonder if it is legal in SQL Server.
>
>>I need to amend my initial reply here. What does not work is a union where the same field in the second query is a smaller size. For example
SELECT cName FROM mytable UNION SELECT cName FROM someothertable
results in error 1851 if cName is C(10) in mytable and C(1) in someothertable (i.e., smaller but not identical).
>>
>>No error is generated if you use space(1) in the second query
SELECT cName FROM mytable UNION SELECT SPACE(1) FROM someothertable
although the result is not necessarily what one would expect.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform