Forum Replies Created

Viewing 15 posts - 1,066 through 1,080 (of 1,409 total)

  • RE: pivot? can't make it work.

    Take a look at the blog from Aaron Bertrand where he builds a dynamic PIVOT solution:

    http://www.mssqltips.com/sqlservertip/2783/script-to-create-dynamic-pivot-queries-in-sql-server/

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: How to get user position in table i.e 1st 2nd, 3rd

    I'm sorry, I didn't understood you wanted all the results in one set. To get this you need to add an OR statement to the WHERE clause;

    select *

    from cte_select

    WHERE

    (rownr >=...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: How to get user position in table i.e 1st 2nd, 3rd

    .Netter (6/20/2013)


    WHERE rownr <= (SELECT rownr - 1

    from cte_select

    where shortAbbr = 'DA7')

    and rownr <= (SELECT rownr + 1

    from cte_select

    where shortabbr = 'DA7')

    You have changed the WHERE clause to a...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: pivot? can't make it work.

    PIVOT will give you the results for each ID in one single row:

    if OBJECT_ID('tempdb..#temp') is not null

    drop table #temp

    create table #temp (id int, characteristic varchar(15), value nvarchar(15))

    insert into#temp

    select 1, 'color',...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: How to get user position in table i.e 1st 2nd, 3rd

    .Netter (6/20/2013)


    Sorry to be a pain, can you tell me how i can return the top performer as well as the additional three rows?

    The top performer would have rownr =...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: How to get user position in table i.e 1st 2nd, 3rd

    Your provided sample code is probably a bit different from your actual data. The values 'D09' and 'D13' in your sample code are put in the column "Firstname". In you...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: SQL server agent SSIS error

    etl.laptop (6/19/2013)


    (reason: A required privilege is not held by the client).

    This indicates an issue with permissions. Are you able to execute the package manually? Check all permissions of the service-account...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: How to get user position in table i.e 1st 2nd, 3rd

    HanShi (6/20/2013)You could wrap the above code in another select if you only want a selection of the resultset.

    This is the code if you want only the row for a...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: How to get user position in table i.e 1st 2nd, 3rd

    Will this do the trick?

    select

    ROW_NUMBER() over (order by count(ReviewedBy) desc) as rownr

    , ShortAbbr

    , firstname

    , surname

    , count(ReviewedBy)

    from dbo.Users

    inner join dbo.ProspectLead

    on firstname = ReviewedBy

    group by ShortAbbr

    , firstname

    , surname

    order by

    count(ReviewedBy) desc

    You could wrap...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: Run inserts from file with many records

    You can use the import/export wizard to create a SSIS package (or create a SSIS from scratch).

    You can use the BCP command http://msdn.microsoft.com/en-us/library/aa337544.aspx to load the file from the commandprompt.

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: How to get user position in table i.e 1st 2nd, 3rd

    Could you provide some sample data ("create table" and "insert" statements) and state the desired output using this sample data. That way we can help you better and there would...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: having trouble granting role to user

    vxhughes (6/19/2013)


    But suppose you didn't know that, for whatever reason

    If you don't know that, then you would be shooting in the dark :exclamation:. When you alter security rights you need...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: SQL Server 2008 view Query

    This will give you the results:

    select a.ItemID, a.ItemName, a.Qty - b.Qty as current_inventory

    FROM Inventory AS a

    LEFT JOIN Sales AS b

    ON a.ItemID = b.ItemID

    When there could be more rows in Sales...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: SQL 2008 - Remove cluster node

    The cluster part of a clustered SQL installation is determined by the Windows cluster group. So if a node crashes, you can evict the node in Windows. No additional work...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • RE: Detect missing db FULL backup and backup that db

    This query gives you the date of the last FULL backup of each database or gives you the commandline to perform a FULL backup. Adjust this commandline in the query...

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **

Viewing 15 posts - 1,066 through 1,080 (of 1,409 total)