Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Union and calculated field
Message
 
 
To
28/02/2010 02:12:05
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01451565
Message ID:
01451575
Views:
39
This message has been marked as a message which has helped to the initial question of the thread.
>>Which field is Text datatype? If you're using SQL 2005 and up, cast TEXT field to varchar(max).
>
>Url2 was Text datatype. I have adjusted and it works.
>
>>Also, IMHO, it doesn't make much sense to have char(74) field. I would use varchar(74) instead.
>
>Why would that be?
>

IMHO, using char type makes sense only when you know that all 74 characters are always populated. Say, it makes sense to have Char(2) for State field or Char(1) for some type field.

However, if you need to store variable length information, then it makes much more sense to use VARCHAR type rather than CHAR to save space.

>>Finally, if you want to get rid of the error, use UNION ALL instead of UNION.
>
>When I use UNION ALL, it worked even before I changed the Text. What does UNION ALL exactly?

UNION performs distinct and therefore certain types can not be used with UNION. (You'll get the same error if you try to use UNION and memo fields).

UNION ALL doesn't perform DISTINCT operation and therefore we can use it even with TEXT type in SQL Server or Memo field in VFP.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform