SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Server 2005 for SQL2k Developer (Part 1)?


SQL Server 2005 for SQL2k Developer (Part 1)?

Author
Message
Muhammad Choirul Amri
Muhammad Choirul Amri
SSC Rookie
SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)

Group: General Forum Members
Points: 35 Visits: 25
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/mcAmri/sqlserver2005forsql2kdeveloperpart1.asp
Duray AKAR
Duray AKAR
SSC Journeyman
SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)SSC Journeyman (89 reputation)

Group: General Forum Members
Points: 89 Visits: 1

Clean and clear demonstration of such a useful feature...

Thank you


ed_elfrink
ed_elfrink
SSC Rookie
SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)SSC Rookie (45 reputation)

Group: General Forum Members
Points: 45 Visits: 134
I look forward to more...thanks!



Paul E
Paul E
Valued Member
Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)Valued Member (66 reputation)

Group: General Forum Members
Points: 66 Visits: 99
Thanks for the examples. In case anyone is working through them, the case statement has a typo with a '2002' replaced with a '2001'
Jim Brady
Jim Brady
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 1

Thankyou I found your article very helpful and presented in a clear style. I look forward to reading more of your work


Muhammad Choirul Amri
Muhammad Choirul Amri
SSC Rookie
SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)

Group: General Forum Members
Points: 35 Visits: 25
Hi Paul,

thanks for the correction of the typo.
The query still works fine, but order year 2001 will be interpreted as 2002 .

It should be like this:

SUM(CASE when OrderYear = 2002 then SubTotal ELSE 0 end) as '2002',
Sunil Lathar
Sunil Lathar
Grasshopper
Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)Grasshopper (23 reputation)

Group: General Forum Members
Points: 23 Visits: 1
i look farward for more. thanks !


slathar
Muhammad Choirul Amri
Muhammad Choirul Amri
SSC Rookie
SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)SSC Rookie (35 reputation)

Group: General Forum Members
Points: 35 Visits: 25
Hi All,

I'm working on second installment of this series now. Just wait
Pam Brisjar
Pam Brisjar
Hall of Fame
Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)Hall of Fame (3.1K reputation)

Group: General Forum Members
Points: 3086 Visits: 2804

Good intro. Thanks.

I've got a question, though. Given this statement from your article:

INSERT INTO SalesByPerson
SELECT SalesPersonID, [2002],[2003],[2004] FROM Sales.SalesSummarry
PIVOT(SUM(SubTotal) FOR OrderYear IN
([2002],[2003],[2004])) as SalesPivot

is the IN (.....) required? What if I don't know the values and/or the values change? Am I stuck with dynamic SQL? Could I maybe put a sub-query (i.e. select DISTINCT OrderYear) in there?


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search