Viewing 15 posts - 2,641 through 2,655 (of 5,588 total)
jamesniesewand (11/1/2010)
Hi Wayne,That's exactly what I suspected I was missing - and thank you muchly for your reply.
Great, I'm glad it's working right. Thanks for posting the DML/DDL to produce...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
November 1, 2010 at 12:42 pm
T3mplarKn1ght (11/1/2010)
In the sample data I've left out some of the extraneous data.
Please go back to the link that Craig pointed you to, and read that article (it's the same...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
November 1, 2010 at 12:21 pm
And what happens if the bottom 5 people have the worse wage, and what you want is the 6th person (2nd lowest wage)? You might want to use the RANK()...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
November 1, 2010 at 12:15 pm
;WITH CTE AS
(
SELECT t.ExampleTableID,
t.ExampleProduct,
t.ExampleValue,
RN = RANK() OVER (PARTITION BY...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
November 1, 2010 at 12:03 pm
I see no reason why your variables in the c.u.r.s.o.r. are not being updated - would you mind posting the entire procedure for us to look at?
Also, if you can...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
November 1, 2010 at 10:53 am
mbender (11/1/2010)
awesome I will take a look at this. Thank you very much, this is exactly why i come to this site.Thanks for all your help!
I'm glad that I...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
November 1, 2010 at 10:48 am
If you can use freeware, http://www.ssmstoolspack.com has this feature.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
November 1, 2010 at 9:30 am
declare @field varchar(5);
set @field = 'class';
declare @sqlcmd varchar(max);
SET @sqlcmd = '
SELECT ' + @field + ' = STUFF((SELECT '','' + ' + @field + '
...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
November 1, 2010 at 8:39 am
GilaMonster (10/31/2010)
Just noticed that I missed spotting a milestone. Better (a little) late than never
Congratulations Gail!
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
October 31, 2010 at 8:03 pm
It still has to be declared before it is referenced... if you move the if/declare block to the end of the code, it does generate an error.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
October 31, 2010 at 12:38 am
Jeff - what do you mean by "overlapping" dates, and how does this differ from determining gaps/islands?
(If it's different, we probably ought to add one for each of those.)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
October 30, 2010 at 10:34 pm
WayneS (10/28/2010)
Jeff Moden (10/28/2010)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
October 30, 2010 at 10:23 pm
Jeff Moden (10/30/2010)
Kevin Bullen (10/30/2010)
In reviewing code written by a contractor, they declare a table variable inside a cursor, but it is never used. The cursor...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
October 30, 2010 at 7:18 pm
Jeff Moden (10/30/2010)
Ya beat me to it by a long shot. Well done.
Thanks. I've got just five words to say... "SQL Server MVP Deep Dives[/url]"
Oddly enough, I just wrote...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
October 30, 2010 at 7:13 pm
An alternative method (faster, less reads) is:
declare @StartDate smalldatetime;
set @StartDate = '20100103';
WITH CTE AS
(
-- Group each date by the difference between that day and the row number
-- (sequential dates will...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
October 30, 2010 at 10:06 am
Viewing 15 posts - 2,641 through 2,655 (of 5,588 total)