Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

PIVOT UNPIVOT IN SQL2005 Expand / Collapse
Author
Message
Posted Monday, May 10, 2010 10:32 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, February 17, 2014 11:24 PM
Points: 35, Visits: 53
Thank U so so much Cold Coffee,And very sorry that I am responding today as I had left my office at that moment.

May I know your name please, as U can guess I am subhro from India.
Can u just explain what is the idea behind this query you have send?



Thanks

Subhro
Post #919425
Posted Monday, May 10, 2010 10:37 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, February 17, 2014 11:24 PM
Points: 35, Visits: 53
Thanks for your assistance

Cheers

Subhro
Post #919427
Posted Monday, May 10, 2010 11:06 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, April 07, 2014 3:41 PM
Points: 2,259, Visits: 5,395
Subhro,

There is a REPLACE operation followed by the CAST in my code.

REPLACE will replace a set of characters , with a replacement value , on the string in which you want a part of it to be replaced. For syntax, kindly refer to the link i provided in the previous post!

In our case, we dont need cnt from the OrderYear column.

So, we used REPLACE('cnt2007', 'cnt', '') ;
This implies, in the string 'cnt2007', if u find 'cnt' in it, replace it with '' (a empty string). Thus, at the end of this code, your new string will be '2007'; As we need that to be INT, we cast '2007' to INT.

Hope this information helps you! If you further need assistance , let us know here!

I am Prasanna, from India! Glad to help you and meet you in the forums!

Cheers!
Post #919437
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse