Viewing 15 posts - 13,096 through 13,110 (of 15,381 total)
Nice job posting ddl and sample data.
Here is one way off the top of my head.
select program, pstatus, form
from
(
select *
, ROW_NUMBER() over (partition by program order by...
February 2, 2012 at 1:45 pm
Here is an example of what I mean (based on your previous post)
create table #TableA
(
TextName char(3)
)
create table #TableB
(
ID int,
Ind int,
TextName char(3)
)
insert #TableA
select 'ABC'
union all
select 'DEF'
union all
select 'GHI'
insert #TableB
select 101,...
February 2, 2012 at 12:49 pm
I can't post the data as it is sensitive therefore I was trying to take Employee Dept example.
That's no problem. Just make up some sample data.
Problem Statement : For each...
February 2, 2012 at 12:43 pm
Can you explain more clearly what you are trying to do? I don't see what a cursor has to do with this at all. Are you trying to update table1...
February 2, 2012 at 12:04 pm
andre-394971 (2/2/2012)
February 2, 2012 at 11:54 am
Another thing you could do that would help with the size is to remove
S.SchoolName, S.School
from each one of the subqueries. It is not needed or referenced outside of...
February 2, 2012 at 10:35 am
So what does the actual data in the column look like? Your description left me scratching my head in bewilderment. :w00t:
February 1, 2012 at 2:19 pm
What you are working is a dynamic cross tab. It is outlined in the second article I posted but you have to get a bit creative with your aggregation to...
February 1, 2012 at 1:26 pm
There is absolutely no reason to do this row by row. Below is an example that meets the requirements as you described them.
create table #Table1
(
FirstName varchar(20),
LastName varchar(20),
Occupation varchar(70),
ID uniqueidentifier
)
create table...
February 1, 2012 at 1:06 pm
EdA ROC (2/1/2012)
Here's where I am in developing the statement:
select ORDER_NO, SUM(qty_alloc)
from ORD_MATL_CST
where MATL_CATEGORY = 'RSCMP'...
February 1, 2012 at 12:40 pm
Look at the output clause. http://msdn.microsoft.com/en-us/library/ms177564.aspx
For the record unless you have a real reason for uniqueidentifier I would not use them as your primary key. I would suggest that an...
February 1, 2012 at 12:33 pm
Does something like this get you closer?
Notice I created ddl and sample data so we know we are all on the same page.
create table #data
(
ParentID int,
ChildName varchar(25)
)
insert #data
select 1, 'Tom'
union...
February 1, 2012 at 12:27 pm
Cadavre (2/1/2012)
Sean Lange (2/1/2012)
You take the RIGHT road and I'll take the LEFT road, and I'll be in Scotland before ye. :Whistling:
Oh dear. . . has it been a long...
February 1, 2012 at 10:25 am
I think I would cry in public if I found this cursor on my system
+1
February 1, 2012 at 8:50 am
Viewing 15 posts - 13,096 through 13,110 (of 15,381 total)