Viewing 15 posts - 1,066 through 1,080 (of 1,409 total)
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/
June 20, 2013 at 5:24 am
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 >=...
June 20, 2013 at 5:12 am
.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...
June 20, 2013 at 4:44 am
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',...
June 20, 2013 at 4:32 am
.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 =...
June 20, 2013 at 4:18 am
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...
June 20, 2013 at 3:55 am
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...
June 20, 2013 at 3:49 am
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...
June 20, 2013 at 3:42 am
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...
June 20, 2013 at 3:33 am
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.
June 20, 2013 at 3:09 am
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...
June 20, 2013 at 3:05 am
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...
June 19, 2013 at 11:45 pm
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...
June 19, 2013 at 4:37 am
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...
June 19, 2013 at 4:26 am
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...
June 19, 2013 at 4:01 am
Viewing 15 posts - 1,066 through 1,080 (of 1,409 total)