October 2006 Blog Posts
If there can be a culture insensitive format for dates (yyyymmdd) then why is there no such thing as a culture insensitive format for decimals?
I suggest a use of # or ~ instead of the decimal separator in update and insert scripts only.
And it would be allowed only in numeric/decimal/float datatypes.
so you could do:
create table t1 (MyDecimalCol decimal (16,3))
insert into t1 (MyDecimalCol)
select 123#456 union all
select 789#123
select MyDecimalCol
from t1
-- would give:
123.456 789.123
-- or
123,456 789,123
-- depending on your locale
Wouldn't that be great?
I already suggested to Microsoft a culture neutral decimal separator a while back.
(Does anyone know the URL of the...
I've seen this technique a few months ago on a local MS event called NT Conference
presented by Slovenian MVP Dejan Sarka.
However i haven't seen him blog about it yet (a shame) so after seeing this post
by co blogger David Moloney here on SQLTeam blogs in this post about EAV i decided to give this little
thing a go by myself.
I've also chosen the same DB model as david for comparison:
A Client can have many “end user” defined data elements.
For the purpose of this example we will choose 5 data elements
to focus on the modelling aspect
Age – Integer greater...
Ever since I discovered the ?? colaesce operator I embraced it with full force.
Today I discovered another usefull use:
// this:
string[] arrayOfStrings1 = new string[] { "arr1s1", "arr1s2", "arr1s3" };
foreach (string str in (arrayOfStrings1 ?? new string[0]))
{
// do some stuff on the array elements
}
// equals to this:
string[] arrayOfStrings2 = new string[] { "arr2s1", "arr2s2", "arr2s3" };
if (arrayOfStrings2 != null)
{
foreach (string str in arrayOfStrings2)
{
// do some stuff on the array elements
}
}
// in terms of what it does
This...
I usually don't do these kind of posts but for this i'll make an exception :)
This is such an awsome tool for me for one reason only: SQL Formatting
It takes you query and formats it with the template that you can also change yourself.
you can download it here.
support forum is here.
It will also come in a bundle with SQL Prompt 3.0.
If all that that was a woman i'd make sweet love to it. that's how much addiction this caused me. :))
SIMPLY AWSOME!