Rob Gonda's Blog

Select * from Ben

Ben Forta has been blogging about mssql lately, but we shall thank him since it's useful information.
For example, here's a comparison between temp tables and table variables. I always use table variables -- a lot -- and they're quite useful. I never ran into any of the restrictions Ben mentioned, but it's good to know that if I run into any of them, there is an alternative; for example, I never had to Select Into a table variable, but I do see where it can be extremely handy.

Another nice post mentions how to perform case sensitive searches w/o changing the collation for the entire database. As you may know, you may define different collations when creating a database which will indicate the character set and case sensitivity among other properties, but you can use a different collation in run time; I actually did not know that. Ben shows two examples:

SELECT *
FROM MyTable
WHERE Col3 COLLATE SQL_Latin1_General_CP1_CS_AS LIKE '%foo%'
--- or ---
CRETE VIEW MyTableCS AS
SELECT Col1, Col2, Col3 COLLATE SQL_Latin1_General_CP1_CS_AS as Col3
FROM MyTable

This reminds me that I should blog more about SQL ... you may expect some coming soon.

TrackBacks
There are no trackbacks for this entry.

Trackback URL for this entry:
http://www.robgonda.com/blog/trackback.cfm?50698CDF-3048-7431-E4B6FE0F6247E5FC

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
This blog is running version 5.9.003. Contact Blog Owner