Showing posts with label below. Show all posts
Showing posts with label below. Show all posts

Friday, March 30, 2012

Question with SQL String

I have this code below to parse the string ''00120212~pendin~mod pen~ria te~3/6/2007 3:51:49 pm'' into Multiple columns.

Here is the code, but the code is splititng the columns incorrectly.

I need it to appear as

col1 col2 col3 col4 col5
00120212 pendin mod pen ria te 3/6/2007 3:51:49 pm
Can someone pl assist with this code below.

-

DECLARE @.str varchar(8000)
SET @.str = '00120212~pendin~mod pen~ria te~3/6/2007 3:51:49 pm'

DECLARE @.columns TABLE (
col1 varchar(8000)
,col2 varchar(8000)
,col3 varchar(8000)
)

SET @.str = LTrim(RTrim(@.str))

DECLARE @.col1 int
,@.col2 int
,@.col3 int

SET @.col1 = CharIndex('~', @.str, 0)
SET @.col2 = CharIndex('~', @.str, @.col1 + 1)
SET @.col3 = CharIndex('~', @.str, @.col2 + 1)

INSERT INTO @.columns
VALUES (
SubString(@.str, 2, @.col1 - 2)
,SubString(@.str, @.col1 + 3, Len(@.str) - @.col2 - 4)
,SubString(@.str, @.col2 + 3, Len(@.str) - @.col3 - 1)
)


SELECT * FROM @.columns

You may find Jen Suessmeyer's Split function to be very useful for this situation.

Split Function (Jens Suessmeyer)
http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=419984&SiteID=17
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=326300&SiteID=1

|||

Please check out the link below:

http://www.sommarskog.se/arrays-in-sql.html

It contains few TVFs that can be used to split a string based on a delimiter. You can use it along with PIVOT for example to get the individual values easily like:

SELECT p.[1], p.[2], p.[3], p.[4], p.[5]

FROM split_str(@.str, '~') AS t

PIVOT (min(t.value) for t.idx in ([1], [2], [3], [4], [5])) as p

Alternatively, you can do these type of operations easily on the client side and send the values individually. This way you can use SQL for what it is supposed to do.

|||

This is by code below, Delimiter is ~. I need to split the values, into multilple field , based on the ~ being the delimiter. How do I loop throu this string, until the end of the string, and then split it one - by-one into multiple fileds? PL ADVISE?

Declare @.Str Varchar(1000),@.I Int

set @.str='0001232~PENDING~MOD PENDING~Trad Jane~3/29/2007 5:03:30 PM~0001232~PENDING~MODIFICATION PENDING~ Jane Delder~3/29/2007 5:05:06 PM~0001232~PENDING~Approved~ Mon Savy~3/29/2007 5:05:27 PM~0001232~PEND'
SET @.str = LTrim(RTrim(@.str))

DECLARE @.columns TABLE (
LoanNum varchar(8000)
,ConvertedFromStatus varchar(8000)
,ConvertedToStatus varchar(8000)
,ConvertedName varchar(8000)
,StatusChangedDate text
)


begin
Begin
DECLARE @.col1 int
,@.col2 int
,@.col3 int,
@.col4 int

SET @.col1 = CharIndex('~', @.str, 0)
SET @.col2 = CharIndex('~', @.str, @.col1 + 1)
SET @.col3 = CharIndex('~', @.str, @.col2 + 1)
SET @.col4 = CharIndex('~', @.str, @.col3 + 1)
--print @.col1
--print @.col2
--print @.col3
--print @.col4


INSERT INTO @.columns
VALUES (
Left(@.Str, @.Col1 - 1),
SubString(@.Str, @.Col1 + 1, @.col2 - @.Col1 - 1),
SubString(@.Str, @.Col2 + 1, @.col3 - @.Col2 - 1),
SubString(@.Str, @.Col3 + 1, @.col4 - @.Col3 - 1),
SubString(@.Str, @.Col4 + 1, @.col4 )
)
End

--Select @.I = 0

End
SELECT * FROM @.columns

|||Does the Split function I previously posted for you not work properly?

Monday, March 26, 2012

question regarding CASE and GROUP BY

I have the below query and I am not sure if this will return an accurate aggregate, I know I cannot just group by my alias GLG_DELEGATE_ID, is this the way to handle aggregates when you have a CASE in the SELECT statement?

SELECT CASE
WHEN C.GLG_DELEGATE_ID IS null THEN C.GLG_ID
ELSE C.GLG_DELEGATE_ID
END AS GLG_DELEGATE_ID
,COUNT(P.CONSULTATION_ID) ACTIVITY_AMOUNT
FROM
dbo.CONSULTATION C
GROUP BY
C.GLG_DELEGATE_ID
, C.GLG_IDNo, just repeat your CASE code in the WHERE clause:

SELECT CASE WHEN C.GLG_DELEGATE_ID IS null THEN C.GLG_ID
ELSE C.GLG_DELEGATE_ID
END AS GLG_DELEGATE_ID
,COUNT(P.CONSULTATION_ID) ACTIVITY_AMOUNT
FROM dbo.CONSULTATION C
GROUP BY CASE WHEN C.GLG_DELEGATE_ID IS null THEN C.GLG_ID
ELSE C.GLG_DELEGATE_ID END
,C.GLG_ID

Monday, March 12, 2012

Question on Multiple Parent-Child Hierarchies

Hi all,

I have a business scenario which is shown in the below hierachy which has 4 levels. Typically the fact table will hold data at the Project manager Level i.e Level 4. I want to implement a solution in SSAS 2005 such that it can create multiple parent child hierarchy

Can you please provide me with a data model whcih can do this?

I am aware of Many to Many dimensions but not sure how it can be implemented in SSAS 2005 based on the person logging into the cube i.e it will have an Employee Table with LOGIN ID.

Scenario 1:

Mgr1 can execute projects under Business CIO1 and Business CIO2, i.e. cross hierarchy is also possible.

Scenario 2:

A CIO at level 2 i.e. CIO1 can have horizontal level access of CIO2 also even though members of CIO2 are not reporting to CIO1.

CEO

/ \

/ \

/ \

CIO1 CIO2

/ \

/ \

/ \

Business CIO1 Business CIO2

/ \

/ \

/ \

Mgr1 Mgr2

Please treat this as urgent as i need to implement this as soon as possible for the security design

Regards

Sai

I do not fully understand the diagram you present in your question. Are you saying you have a member who may have multiple parents?

Regarding parent-child hierarchies in general, you can have only 1 per dimension. This is enough for most users. If you have a fixed number of levels and data associated with just the leaf-level of the hierarchy, you can implement your solution as a standard hierarchy. If you truly have two parent-child hierarchies, my advice would be to implement two dimensions, each with a single parent-child hierarchy.

B.

|||

Hi Bryan,

Yes am saying about a member having multiple parents. Can you please let me know how this can be achieved and based on the login ID I need to filter the members and fact data. Do you have a solution or any data model which can support this.

Regards

Sai Krishna

|||

If a member is part of independent parent-child hiearchies, you would need to implement two dimensions. Each dimension would house one of the parent-child hierarchies.

If a member may have multiple parents and those parents may have multiple parents and there is no logical/topical separation between these relationships, I'm not sure of a way to proceed. This kind of relationship is referred to as a network relationship and I do not believe SSAS supports this.

B.

Friday, March 9, 2012

Question on Integration of SSRS 2005 Graphs into Sharepoint

I have been assigned to work on a dashboard (see jpg below) which will hook into our Intranet on SharePoint 2003. I have a few questions as in teh approach and what is possible by creating charts through SSRS 2005 report(s):

http://photopizzaz.biz/dashboard.jpg

1) what technique to use to show all 4 graphs simultaneously on the same page in SharePoint Webparts? Is WebParts the best way here to accomplish this?

2) Eventually, they want to be able to click through on the graph parts such as bars, etc. and perform clickthrogh using Reporting Services. How can this be seupt on graphs like these? What is the approach and requirements in Designer...how to do this?

Hi,

We did a dashboard using sharepoint services, and we segmented the screen in two different zones calling 2 static report containers, in which we set subreports. Therefore, as soon as you have defined your 2 containers, if you want to modify the content you don't have to set your changes in sharepoint, you just have to modifiy the subreport link.

For the link through graph parts, I use popup links.

Check your mail, I send you a printscreen

Regards

Ayzan

|||

I have never touched Sharepoint. My boss expects this done in 2 days. Could you walk me through in detail how you created the report containers and how you linked the subreports to them...and if you used one .rdl period for all the subreports or one .rdl for each graph? I am new to all this so any help would be greatly appreciated to help me walk through this for the first time.

When you create those containers, you're saying it just points to the .rdl via a link somehow and renders the report in that container?

Did you create one report then the rest subreports or all subreports? (I don't even think all subreports is possible, but just wanted to find out)

|||

Azyan,

When you say you defined 2 zones, you mean 2 columns in the WebParts layout for the .aspx page?

|||

First check

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=239997&SiteID=1

Ayzan

|||

Yes 2 columns ... 3 if you need a menu.

For each graph you will desing in SSRS, we tried to respect these dimensions

11cm/8cm to display 4 graphs -> 1cm between each graphs

1 2

3 4

23cm/8cm for 1 graph

1

2 3

or

1 2

3

For each line, we set "a container" which is a report calling 1 or 2 subreports. Once configured the containers (dimensions in pixel, tool bars ....), it will be not necessary to set them again. You will just have to modify the subreports called and republish the containers and the subreports.

regards

Ayzan

Wednesday, March 7, 2012

Question on DEveloper EDition Client Tools Only

Hi:
Our developer's are supposed to use SQL Server Developer Edition Client
Tools Only.
Can anybody tell me if any of the components below could be considered
as that tool?
Many thanks in advance.
Analysis Services Shared Tools
=B7 Business Intelligence Development Studio
=B7 Connectivity Components
=B7 Legacy Components
=B7 Management Tools
=B7 Notification Services Client Components
=B7 Reporting Services Report Manager
=B7 Reporting Services Shared Tools
=B7 SQL Server 2005 Shared Tools
=B7 Software Development Kit
=B7 SQLXML Client Features
=B7 SQL Server 2005 Books Online
=B7 SQL Server Mobile Server ToolsDataPro wrote:
> Hi:
> Our developer's are supposed to use SQL Server Developer Edition Client
> Tools Only.
> Can anybody tell me if any of the components below could be considered
> as that tool?
> Many thanks in advance.
> Analysis Services Shared Tools
> Business Intelligence Development Studio
> Connectivity Components
> Legacy Components
> Management Tools
> Notification Services Client Components
> Reporting Services Report Manager
> Reporting Services Shared Tools
> SQL Server 2005 Shared Tools
> Software Development Kit
> SQLXML Client Features
> SQL Server 2005 Books Online
> SQL Server Mobile Server Tools
>
Those are basic SQL Server components. You're asking the wrong
question, it's not the components that you need to worry about, it's
where they were installed from. Were they installed from SQL Server
Developer Edition media, or one of the other editions?
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Our software aquisition folks tell me that they were in the contract as
sub components of SQL Server 2005 Standard and Enterprise Editions.
Does that make sense?
I was told that if one attempted to install SQL Server on a server that
could work. However attempting to install it on a workstation would
only allow the installation of Query Analyzer. So I'm not sure if any
other client tools could be installed that way.
Thanks for the help.
Tracy McKibben wrote:
> DataPro wrote:
> Those are basic SQL Server components. You're asking the wrong
> question, it's not the components that you need to worry about, it's
> where they were installed from. Were they installed from SQL Server
> Developer Edition media, or one of the other editions?
>=20
>=20
> --=20
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com

Question on DEveloper EDition Client Tools Only

Hi:
Our developer's are supposed to use SQL Server Developer Edition Client
Tools Only.
Can anybody tell me if any of the components below could be considered
as that tool?
Many thanks in advance.
Analysis Services Shared Tools
=B7 Business Intelligence Development Studio
=B7 Connectivity Components
=B7 Legacy Components
=B7 Management Tools
=B7 Notification Services Client Components
=B7 Reporting Services Report Manager
=B7 Reporting Services Shared Tools
=B7 SQL Server 2005 Shared Tools
=B7 Software Development Kit
=B7 SQLXML Client Features
=B7 SQL Server 2005 Books Online
=B7 SQL Server Mobile Server ToolsDataPro wrote:
> Hi:
> Our developer's are supposed to use SQL Server Developer Edition Client
> Tools Only.
> Can anybody tell me if any of the components below could be considered
> as that tool?
> Many thanks in advance.
> Analysis Services Shared Tools
> · Business Intelligence Development Studio
> · Connectivity Components
> · Legacy Components
> · Management Tools
> · Notification Services Client Components
> · Reporting Services Report Manager
> · Reporting Services Shared Tools
> · SQL Server 2005 Shared Tools
> · Software Development Kit
> · SQLXML Client Features
> · SQL Server 2005 Books Online
> · SQL Server Mobile Server Tools
>
Those are basic SQL Server components. You're asking the wrong
question, it's not the components that you need to worry about, it's
where they were installed from. Were they installed from SQL Server
Developer Edition media, or one of the other editions?
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Our software aquisition folks tell me that they were in the contract as
sub components of SQL Server 2005 Standard and Enterprise Editions.
Does that make sense?
I was told that if one attempted to install SQL Server on a server that
could work. However attempting to install it on a workstation would
only allow the installation of Query Analyzer. So I'm not sure if any
other client tools could be installed that way.
Thanks for the help.
Tracy McKibben wrote:
> DataPro wrote:
> > Hi:
> >
> > Our developer's are supposed to use SQL Server Developer Edition Client
> > Tools Only.
> >
> > Can anybody tell me if any of the components below could be considered
> > as that tool?
> >
> > Many thanks in advance.
> >
> > Analysis Services Shared Tools
> >
> > =B7 Business Intelligence Development Studio
> >
> > =B7 Connectivity Components
> >
> > =B7 Legacy Components
> >
> > =B7 Management Tools
> >
> > =B7 Notification Services Client Components
> >
> > =B7 Reporting Services Report Manager
> >
> > =B7 Reporting Services Shared Tools
> >
> > =B7 SQL Server 2005 Shared Tools
> >
> > =B7 Software Development Kit
> >
> > =B7 SQLXML Client Features
> >
> > =B7 SQL Server 2005 Books Online
> >
> > =B7 SQL Server Mobile Server Tools
> >
> Those are basic SQL Server components. You're asking the wrong
> question, it's not the components that you need to worry about, it's
> where they were installed from. Were they installed from SQL Server
> Developer Edition media, or one of the other editions?
> > > -- > Tracy McKibben
> MCDBA
> http://www.realsqlguy.com