Viewing 15 posts - 136 through 150 (of 388 total)
Cadavre (7/6/2012)[hrActually, this would probably be more accurate: -
SELECT pk, pcode
FROM postcode
CROSS APPLY (SELECT REPLACE(pcode COLLATE Latin1_General_BIN2,' ','')) b(fixedPcode)
WHERE fixedPcode LIKE '[A-Z][A-Z0-9][0-9][A-Z][A-Z]'
OR fixedPcode LIKE '[A-Z][A-Z0-9]_[0-9][A-Z][A-Z]'
OR fixedPcode LIKE '[A-Z][A-Z0-9]__[0-9][A-Z][A-Z]'
Out of curiosity,...
July 6, 2012 at 4:05 am
I think our lasts posts crossed in the webosphere.
Thanks for your feedback. Actually I did a similar test on "a big table I had lying about", but got slightly...
July 6, 2012 at 3:58 am
I stand corrected about the cross apply, it performs better than the CTE - i guess with the Replace we're already 'line by line'.
Also I note that the collation on...
July 6, 2012 at 3:53 am
David McKinney (7/6/2012)
(But you're right that if you're on a case sensitive server, including the collation would be wise.)
Actually I don't get the collate on the replace - I...
July 6, 2012 at 3:37 am
Cadavre (7/6/2012)[hrActually, this would probably be more accurate: -
SELECT pk, pcode
FROM postcode
CROSS APPLY (SELECT REPLACE(pcode COLLATE Latin1_General_BIN2,' ','')) b(fixedPcode)
WHERE fixedPcode LIKE '[A-Z][A-Z0-9][0-9][A-Z][A-Z]'
OR fixedPcode LIKE '[A-Z][A-Z0-9]_[0-9][A-Z][A-Z]'
OR fixedPcode LIKE '[A-Z][A-Z0-9]__[0-9][A-Z][A-Z]'
Depends where you...
July 6, 2012 at 3:16 am
consider also something like the following:
x LIKE '[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9]'
or x LIKE '[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9]'
July 6, 2012 at 2:48 am
Sorry...when I typed it, it didn't look like that!
What I was trying to say was that "<" isn't the same as & lt ; which means that if in notepad...
July 6, 2012 at 12:43 am
I think you've answered the question yourself
<xml> is xml
<xml> is not xml.
July 4, 2012 at 6:06 am
dwain.c (6/5/2012)
SELECT Employee, NEW_LOB, NEW_DEPARTMENT, NEW_COST_CENTRE,...
June 6, 2012 at 1:51 am
Still not clear then if you buy 2 pencils does that count as 2 towards your total, or just one?
Depending on the answer, either the suggestion I provided or something...
June 5, 2012 at 3:00 am
In the data you provide the value are always 1 or 0. i.e. I guess if they buy 2 soaps, the value is nonetheless 1?
If that is so, then...
June 4, 2012 at 8:48 am
You have to explicitly specify the column names i.e. you can't use a variable. Otherwise you don't specify any column names and you specify values for all columns. ...
May 9, 2012 at 9:02 am
Excellent question. I often come across code such as
IF col1 like col2 (without any wildcards)
and I've often wondered why they didn't just put IF col1=col2. Til today...
May 9, 2012 at 1:14 am
I'd been stuck in a IT job (SQL Developer) I didn't like for 8 years. I loved the SQL but hated the job. I say stuck, because there...
April 27, 2012 at 4:51 am
I think this is a great article, with a lot of tasty code to chew over.
Thanks for putting in the effort and sharing!
March 23, 2012 at 3:10 am
Viewing 15 posts - 136 through 150 (of 388 total)