Viewing 15 posts - 3,481 through 3,495 (of 4,085 total)
Cadavre (11/17/2011)
PRINT '========== Alternative=========='
SELECT @Holder = randomDate + randomTime
FROM #testEnvironment
PRINT '========== Alternative 2=========='
SELECT @Holder = DATEADD(SECOND, DATEDIFF(SECOND, 0, randomTime), randomDate)
FROM #testEnvironment
PRINT '========== Alternative 3=========='
SELECT @Holder = DATEADD(d, DATEDIFF(d, randomTime, randomDate),...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 17, 2011 at 8:10 am
You're probably better off leaving the pivot to your reporting software. You don't provide enough details to say for sure.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 17, 2011 at 7:49 am
It has been repeatedly shown that manipulating dates by converting back and forth between character data performs very poorly versus using the datetime functions. The following code will always...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 17, 2011 at 7:33 am
The .value() function requires a singleton, and you may not have specified the singleton correctly.
Drew
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 17, 2011 at 6:57 am
ahmed_b72 (11/16/2011)
Is there a way to avoid displaying every row returned from the cursor?
The best way is to avoid using a cursor in the first place. They perform horribly...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 17, 2011 at 6:49 am
CELKO (11/16/2011)
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 16, 2011 at 3:12 pm
You're most of the way there. This should give you what you want. The vast majority of the time, you'll probably want to use relative paths for everything...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 16, 2011 at 2:47 pm
Your data doesn't have enough information to fully specify the order, so the order is not completely guaranteed. For example 17 could easily render as "Riding on big horses...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 16, 2011 at 1:17 pm
MattieNH (11/16/2011)
I have a table of valid suffixes that I want to loop through (yes, a cursor).
You really don't. There is nothing in your query that indicates that a...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 16, 2011 at 11:54 am
John Mitchell-245523 (11/16/2011)
That UPDATE statement won't loop through the rows in @Dept - it will use the first row in @Depts that it finds and then stop.
Actually, as Jeff Moden...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 16, 2011 at 8:46 am
A good rule of thumb to use is that you should not use code that you find on the Internet unless you understand what it is doing. If a...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 15, 2011 at 3:14 pm
Lowell (11/15/2011)
your example is bending an IF into a situation similar to a CASE, but an IF statement can do much more than that.
I would argue that he's doing the...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 15, 2011 at 1:27 pm
It's because your '<B>' is text, not xml. The easiest way is to use the following:
select
= convert(varchar(3), t.num),'',
...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 15, 2011 at 9:40 am
It looks like you're trying to run this on a SQL 2005 server. MERGE was introduced in SQL 2008, so it will produce those exact errors when run on...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 15, 2011 at 8:26 am
Even so, the performance may still be better using the string splitter than without. The only way to now for sure is thorough testing, which is why I initially...
J. Drew Allen
Business Intelligence Analyst
Philadelphia, PA
November 11, 2011 at 1:21 pm
Viewing 15 posts - 3,481 through 3,495 (of 4,085 total)