Viewing 15 posts - 4,456 through 4,470 (of 5,502 total)
What would be Week one for this year?
Either from 01-02 (Fr - Sat) or 03-09 (Sun-Sat)?
Or, to phrase it a little different:
What needs to be the first day of the...
January 22, 2010 at 10:10 am
I would use the following code.
The first CTE is used to order each guid per lastchanged column (desc order).
The second CTE calculates the sum of the latest two rows.
The final...
January 21, 2010 at 4:17 pm
Glad we could help 🙂
January 21, 2010 at 12:50 pm
Would something like the following code do the job?
DECLARE @t TABLE (IsSet bit)
INSERT INTO @t SELECT 1 UNION ALL SELECT 0
SELECT
CASE WHEN IsSet=0 THEN 'False' ELSE 'True' END AS...
January 21, 2010 at 12:48 pm
dave.repton (1/21/2010)
January 21, 2010 at 12:25 pm
Why not using a solution that doesn't use any while loops at all and do it all in one path?
;with cte
AS
(
SELECT
BusTypeCode,
n1 % (ncolLeft+nColRight) +1 AS Col_X,
row_number() over(partition...
January 21, 2010 at 11:32 am
One reason could be that you're using UNION instead of UNION ALL.
When combining two queries using UNION you'd force an (internal) DISTINCT to be applied to the result set, usually...
January 21, 2010 at 11:10 am
Would something like the following work?
Please note that I added some more lines to make the concept a little easier to understand since your sample data could have been joined...
January 20, 2010 at 2:41 pm
Jeff Moden (1/19/2010)
lmu92 (1/19/2010)
select 'fred', 'unsure', 33716,...
January 20, 2010 at 10:28 am
Where do you get that result set from?
Instead of auto-generating column names you should ensure to get a useable result set in the first place...
January 20, 2010 at 4:16 am
Gianluca Sartori (1/20/2010)
Gianluca Sartori (1/19/2010)
What are writing about, Paul?I started writing my first article 9 months ago and it isn't finished yet.:crying:
Well, I can say that I had a baby...
January 20, 2010 at 4:11 am
You would either have to add a column identifying year + month instead of month only and alter your PIVOT clause to reflect that or you might want to have...
January 19, 2010 at 1:25 pm
... or you can set up an XLS file as a linked server
... or you can use SSIS
... or bcp
... or send an email with the data attached as xls...
January 19, 2010 at 1:21 pm
I would use the input parameter and a split string function together with a join.
Something like this:
DECLARE @input1 as varchar(50)
SET @input1 = '12,15,25,49'
SELECT * FROM
master..spt_values m inner join...
January 19, 2010 at 1:15 pm
Ooopss!! Sorry, my fault (I mixed Object Explorer and Object Explorer Details...):blush:
January 19, 2010 at 12:56 pm
Viewing 15 posts - 4,456 through 4,470 (of 5,502 total)