Forum Replies Created

Viewing 15 posts - 211 through 225 (of 761 total)

  • RE: Pivot And Unpivot Table

    dwain.c (8/6/2012)


    SomewhereSomehow (8/3/2012)


    When you asking about alternate solution you, do mean funtctional equivalent? you may use case+group by instead of pivot, and cross apply instead of unpivot. You may also...

  • RE: Pivot And Unpivot Table

    Using Pivot/unpivot could be more than just a matter of choice. You can definitely avoid the Pivot with Case+Group but then you come across situations where you can't use Case+Group....

  • RE: Reverse Of Number without Using reverse()

    How about this Cadavre???.....

    Declare @num bigint

    Set @num = 12345678

    Select @num As Number, Stuff((select Left(Right(Cast(@num As Varchar(10)), n), 1) From Tally

    Where n <= Len(Cast(@num As Varchar(10))) For XML Path('')), 1,...

  • RE: Order without Order by

    GilaMonster (7/30/2012)


    vinu512 (7/30/2012)


    GilaMonster (7/30/2012)


    Try adding this as a column, and see if it orders 'correctly'. If so, try select into and see if it's still ordered 'correctly'

    ROW_NUMBER() OVER (ORDER BY...

  • RE: Order without Order by

    GilaMonster (7/30/2012)


    Try adding this as a column, and see if it orders 'correctly'. If so, try select into and see if it's still ordered 'correctly'

    ROW_NUMBER() OVER (ORDER BY (SELECT 1))...

  • RE: Order without Order by

    danielfountain (7/30/2012)


    Now here is the problem - i need to have a row_number added to this query, so i can transfer this order to a new table (i am going...

  • RE: any better way of doing this Query

    Jeff Moden (7/25/2012)


    vinu512 (7/25/2012)


    I think this is the simplest way.

    Look at the execution plan for that, Vinu. There are 9 rows in one table and 4 in the other....

  • RE: any better way of doing this Query

    I think this is the simplest way.

  • RE: Filer on Period for Active Versions only.

    Michael Tocik (7/25/2012)


    Hi,

    Thank you Vinu ! That is excatly what I was looking for:-)

    You're Welcome Micheal.

    I'm glad it worked for you. 🙂

  • RE: Filer on Period for Active Versions only.

    This should work for you:

    Select b.* From #Version As a JOIN #TransactionDetail As b ON a.VersionName = b.VersionID And IsActive = 1

    Where (PARSENAME(b.PERIOD, 1) >= PARSENAME(a.StartMonth, 1) )

    And (PARSENAME(b.PERIOD, 1)...

  • RE: Restore Copy of Live DB to Production Server?

    So...how if every restore will cause this problem then how can this be handled....like is there a hint or something which can be specified with the restore statement to avoid...

  • RE: Dynamic Pivot - Grouping Results

    There...that would do it...Clayman beat me to it again. 🙂

  • RE: Dynamic Pivot - Grouping Results

    You need to Group the data. You need to change the Dynamic Pivot Query as follows:

    DECLARE @info-2 nvarchar(max)

    DECLARE @sql nvarchar(max)

    --Added Variable

    DECLARE @Info1 nvarchar(max)

    select @info-2 = STUFF(

    ( select ','+TempSymbol from #TempSymbolList...

  • RE: Add/Insert a character mid string

    Stuff is good. 🙂

    This is just another alternative:

    Declare @string varchar(10) = 'B9876543'

    Select (LEFT(@string, 3) + '.' + RIGHT(@string, (Len(@String) - 3)))

  • RE: Need help with a count.

    You can avoid the CTE and use a Derived table as well as follows:

    Select branch, Sum(Case When rn <= 1 Then 1 Else 0 End) As Count From

    (Select *, (Case...

Viewing 15 posts - 211 through 225 (of 761 total)