Showing posts with label approach. Show all posts
Showing posts with label approach. Show all posts

Saturday, February 25, 2012

Looking for recommended approach to merging records

I am trying to create a dimension table and I am pulling in data from two tables to create it. I need all records from table A, any records from table B that are not in table A, and I need to use the fields from B for those records that do match. What would be the best way to approach this, merge join + derived columns, union all + aggrigation? Any suggestions?

It seems like it's harder to do this in ssis rather then just doing it in the database.

If you think it is easierr to do it in the database then use the database. It is an oft made assumption that if you're using SSIS then you should use it to do EVERYTHING. That's not the case - database engines do what they do fantastically well so if you can use it either by:

Writing SQL in an OLE DB Source

Looking for method to create stem and leaf graph

All,

I would appreciate any advice anyone might have to offer on how to approach creating a stem-and-leaf graph using t-sql. My table structure is as follows:

CREATE TABLE [dbo].[Responses](
[appraisalId] [char](9) NOT NULL,
[userId] [char](9) NOT NULL,
[res1] [decimal](5, 2) NOT NULL,
[res2] [decimal](5, 2) NOT NULL,
[res3] [decimal](5, 3) NOT NULL,
[res4] [decimal](5, 2) NOT NULL,
[res5] [decimal](5, 2) NOT NULL,
CONSTRAINT [PK_Responses] PRIMARY KEY CLUSTERED
(
[appraisalId] ASC,
[userId] ASC
))

ALTER TABLE [dbo].[Responses] WITH CHECK ADD CONSTRAINT [CK_Responses_res1] CHECK (([res1]>=(1) AND [res1]<=(5)))
ALTER TABLE [dbo].[Responses] WITH CHECK ADD CONSTRAINT [CK_Responses_res2] CHECK (([res2]>=(1) AND [res2]<=(5)))
ALTER TABLE [dbo].[Responses] WITH CHECK ADD CONSTRAINT [CK_Responses_res3] CHECK (([res3]>=(1) AND [res3]<=(5)))
ALTER TABLE [dbo].[Responses] WITH CHECK ADD CONSTRAINT [CK_Responses_res4] CHECK (([res4]>=(1) AND [res4]<=(5)))
ALTER TABLE [dbo].[Responses] WITH CHECK ADD CONSTRAINT [CK_Responses_res5] CHECK (([res5]>=(1) AND [res5]<=(5)))

The problem to be solved is to create a stem and leaf graph that shows for each response value column res1 to res5, with valid values 1.0 - 5.0, create a graph similar to the following:

5|11233445567789
4|12233445566789
3|11334556667789
2|11223444567889
1|12233345556778

It was my hope that I could do this using reporting services, but I'll almost settle for being able to produce a two column result set similar to the above.

Best,
Steven

Please post some sample data (input) & expected sample output data.

It will help us to understand the problem quickly.. Smile

|||I believe at this point I've come up with a solution that will work. Perhaps the task of just writing down here what little bit I did helped me to think more clearly about the problem to solve.

I was playing around with a stacked bar chart, and experimented with a custom fill, and wound up with something that actually looks quite like what I wanted.

Thanks for the assist!

Best,
B.

Looking for method to create stem and leaf graph

All,

I would appreciate any advice anyone might have to offer on how to approach creating a stem-and-leaf graph using t-sql. My table structure is as follows:

CREATE TABLE [dbo].[Responses](
[appraisalId] [char](9) NOT NULL,
[userId] [char](9) NOT NULL,
[res1] [decimal](5, 2) NOT NULL,
[res2] [decimal](5, 2) NOT NULL,
[res3] [decimal](5, 3) NOT NULL,
[res4] [decimal](5, 2) NOT NULL,
[res5] [decimal](5, 2) NOT NULL,
CONSTRAINT [PK_Responses] PRIMARY KEY CLUSTERED
(
[appraisalId] ASC,
[userId] ASC
))

ALTER TABLE [dbo].[Responses] WITH CHECK ADD CONSTRAINT [CK_Responses_res1] CHECK (([res1]>=(1) AND [res1]<=(5)))
ALTER TABLE [dbo].[Responses] WITH CHECK ADD CONSTRAINT [CK_Responses_res2] CHECK (([res2]>=(1) AND [res2]<=(5)))
ALTER TABLE [dbo].[Responses] WITH CHECK ADD CONSTRAINT [CK_Responses_res3] CHECK (([res3]>=(1) AND [res3]<=(5)))
ALTER TABLE [dbo].[Responses] WITH CHECK ADD CONSTRAINT [CK_Responses_res4] CHECK (([res4]>=(1) AND [res4]<=(5)))
ALTER TABLE [dbo].[Responses] WITH CHECK ADD CONSTRAINT [CK_Responses_res5] CHECK (([res5]>=(1) AND [res5]<=(5)))

The problem to be solved is to create a stem and leaf graph that shows for each response value column res1 to res5, with valid values 1.0 - 5.0, create a graph similar to the following:

5|11233445567789
4|12233445566789
3|11334556667789
2|11223444567889
1|12233345556778

It was my hope that I could do this using reporting services, but I'll almost settle for being able to produce a two column result set similar to the above.

Best,
Steven

Please post some sample data (input) & expected sample output data.

It will help us to understand the problem quickly.. Smile

|||I believe at this point I've come up with a solution that will work. Perhaps the task of just writing down here what little bit I did helped me to think more clearly about the problem to solve.

I was playing around with a stacked bar chart, and experimented with a custom fill, and wound up with something that actually looks quite like what I wanted.

Thanks for the assist!

Best,
B.