Showing posts with label example. Show all posts
Showing posts with label example. Show all posts

Monday, March 19, 2012

Degenerate dimension with non-numeric data in SSAS

Dear,

I have the following problem/question:

I have a fact table that contains for example all orderline data, with next to that all skey's to my dimension tables (product, customer, date, ...). Next to the measures that are included in my fact table, I was planning to also include a degenerate dimension that contains my ordernumber. So far no problem creating the star schema in a relational database. But trying to set this up in SSAS, the problem comes up that my order number is not a real number but a string (eg 'ABC12345') and as far as I know, the fact table in SSAS cannot contain any string data (or am I wrong?).

Any suggestions?

Thank you in advance for your feedback!

Kind regards,

Jürgen

You are wrong :)

|||

OK, great! Can you also let me know how to add data formatted as string in my relational fact table to my SSAS cube (without creating an additional dimension)? I already tried a lot of things, but without any positive result...

Thx in advance,

Jürgen

|||I am not sure what you mean by "add data formatted as string". Are you talking about adding a varchar measure? I can't see any scenario where you would want to do that.|||

The notion of degenerate dimension in Analysis Services is modeled by using Fact dimension. Not sure why but legal guys didn't let us use "Degenerate" in the product . Must be the case of political correctness:)

You create a new dimension and you include all additional information you would like to see. You define a relationship between your dimension and the measure group as Fact. Then using Drillthrough functionatlity you should be able to provide your users access to this additional information.

Books online should have more information for you on the Fact dimensions and on the Drillthough.

Hope that helps.

Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.

|||Thanks for the useful information, Edward!

Friday, March 9, 2012

Defining your own Functions in XQuery

Hi Kent -
There are third party implementations (for example, DataDirect XQuery)
that support XQuery functions on SQL Server 2005. Microsoft SQL Server
has a lot of partner software vendors.
Sincerely,
The Stylus Studio Team
http://www.stylusstudio.comHello Stylus,
SS> There are third party implementations (for example, DataDirect
SS> XQuery) that support XQuery functions on SQL Server 2005. Microsoft
SS> SQL Server has a lot of partner software vendors.
Sure, but I don't see them edu-advertising their products here, do you?
Look, I understand -- you have a good product, no problems with that. And
does it work with SQL Server 2005? Sure, at least at some level. And I think
that the works of Dr. Kay's that your hosted on your site are helpful to
the XQuery community in general. All I'm taking exception with is that your
potentially setting the exceptation that you're product "magically" enables
UDFs within SQL Server 2005 processed XQueries, or worse yet, that they are
natively supported. So people take time and effort to do that. You've help
set an faulty expecation. When those expectations get upset we're the ones
left to clean up the "damage" -- frustration over wasted time and effort.
That I don't really appreciate.
So if you would, do us a favor -- when your posting something to this group
that isn't natively supported by SQL Server 2005 -- include that in your
post. Then let the customer decide for themselves if what your offering is
really relativant to them not before they expend their time and ours on some
thing
that isn't. It doesn't seem like its asking too much, is it?
If you like somebody help you with that task, I'm more than happy to help.
Thanks!
Kent Tegels
DevelopMentor
http://staff.develop.com/ktegels/

Defining Variables in Date fields within a Trigger?

Hi All,

I am creating an Insert Trigger with following example of code for you to go off(just an example)

DECLARE @.CREATIONDATE VARCHAR(12)
SET @.CREATIONDATE = (Select Inserted.Creation_Date from Inserted)

Insert into fintest.dbo.glf_chart_acct(fintest.dbo.chart_name, fintest.dbo.accnbri, fintest.dbo.descr1, fintest.dbo.date)
Values ('Name', 'Code', 'Description', {d @.CREATIONDATE})

Inserted.CreationDate is Varchar and the fintest.dbo.date colunm is a datetime field

When checking the Syntax for the trigger it errors saying that - 'Error Syntax near '@.CREATIONDATE'

It works fine if I just insert a static value such as
{d '2002-10-10'}. Am I able to replace the static value with a variable and if so what will my syntax be? How would it look?

Thanks
Anthonyhow about:

Insert into fintest.dbo.glf_chart_acct
(chart_name, accnbri, descr1, date)
select 'Name', 'Code', 'Description', Creation_Date
from Inserted

SQL Server will automatically convert a string to a date and you have the advantage of handeling one or more records at a time!|||DECLARE @.CREATIONDATE VARCHAR(12)
SET @.CREATIONDATE = (Select Inserted.Creation_Date from Inserted)

Insert into fintest.dbo.glf_chart_acct(fintest.dbo.chart_name, fintest.dbo.accnbri, fintest.dbo.descr1, fintest.dbo.date)
Values ('Name', 'Code', 'Description', {d @.CREATIONDATE})

Inserted.CreationDate is Varchar and the fintest.dbo.date colunm is a datetime field

How about instead of the {d @.CREATIONDATE} you either put just @.CREATIONDATE or try a CAST(@.CREATIONDATE as datetime)

Wednesday, March 7, 2012

define a default value ?

hallo

i am on the very beginning with sql.s,

how can i define a default value for the table field like its possible in access,

for example: the if the user not gonna enter a val so there is a default val predefined in the table field,

for example i would like to predefine the date now on the smalldate field....

thanks

maybe something like:

Code Snippet

create table dbo.yourTable

( anInteger int default (0)

)

Give a look to books online.

|||

so if i would like to predefine the date now on the smalldate field its will look like this

table dbo.myTable

( anInteger smalldate default (0)=new

)

|||

No, that would be more like:

createtable dbo.myTable

( anInteger smalldate default ( getdate() )

)

|||thanks

Saturday, February 25, 2012

defaults

Can someone give me a simple example of how you use the
defaults in sql server 2000? I cant figure it outSee following exmaple:
(while creating table)
CREATE TABLE multinulls (
a int NULL,
b char(5) default 'hello'
)
you can also create default as an object and bind it to table's column
Ex:
CREATE DEFAULT abc_const AS 'abc'
GO
sp_bindefault abc_const, 'test_defaults.char1'
GO
-Vishal
"bill" <bkelleman@.pcdata1.com> wrote in message
news:02a901c377be$aada4a30$a101280a@.phx.gbl...
> Can someone give me a simple example of how you use the
> defaults in sql server 2000? I cant figure it out|||What exactly do you mean? How to insert default values or How to set it up?
Setup.
For example Open EM, Create a table two columns
Column 1 name it Log_Date datetime with a default of getdate()
Column 2 name it test_data varchar(20)
Open the table and insert something on the test_data column click on the
exclamation point to execute
or simply use query analyzer
BEGIN TRANSACTION
CREATE TABLE dbo.test0001
(
log_date datetime NULL,
test_data varchar(20) NULL
) ON [PRIMARY]
GO
ALTER TABLE dbo.TEST001 ADD CONSTRAINT
DF_Table1_log_date DEFAULT getdate() FOR log_date
GO
COMMIT
INSERT INTO TEST0001(TEST_DATA)
SELECT 'TEST1'
SELECT * FROM TEST0001
If you create a new default on a column to an existing table with data then
you need to do something like
insert into test0001 default values
select * from test0001
Hope this helps
Yovan Fernandez
"bill" <bkelleman@.pcdata1.com> wrote in message
news:02a901c377be$aada4a30$a101280a@.phx.gbl...
> Can someone give me a simple example of how you use the
> defaults in sql server 2000? I cant figure it out

Defaulting Start and End dates to the previous month.

I have two parameters in my report (StartDate and EndDate). I want to default these parameters to the previous month.

For example... If today is 5/17/2007, I want StartDate to be 4/1/2007 and EndDate to be 4/30/2007. If today would be January 30th 2007, I would want StartDate to be 12/1/2006 and EndDate to be 12/31/2006.

How can I do this?

Nevermind... I used the following two functions. However, if you know of a better way to do this, please let me know.

Public Function EndDt() As Date

Dim Today As Date = Date.Today

Dim Day As Integer = Today.Day

Dim EndDate As Date

EndDate = Today.AddMonths(1)

EndDate = Today.AddDays(-Day)

Return EndDate

End Function

Public Function StartDt() As Date

Dim Today As Date = Date.Today

Dim Day As Integer = Today.Day - 1

Dim StartDate As Date

StartDate = Today.AddMonths(-1)

StartDate = Today.AddDays(-Day)

Return StartDate

End Function

|||

I can't think of a quick direct way

but I do want to suggest using BETWEEN, and first of month (so that you don't have to worry about # of days in a month)

e.g. for 05/17/2007

you'd want SQL code to be

Code Snippet

column BETWEEN 04/01/2007 AND 05/01/2007

since BETWEEN is inclusive, but only up to '05/01/2007 00:00:00', anything after 05/01/2007 midnight will NOT show up

so in backend SQL

it'll be like

Code Snippet

SELECT
previous_month = CAST( MONTH(getdate())-1 AS varchar) + '/01/' + CAST(YEAR(getdate()) AS varchar)
, current_month = CAST( MONTH(getdate()) AS varchar) + '/01/' + CAST(YEAR(getdate()) AS varchar)

then you get

previous_month current_month

4/01/2007 5/01/2007

Tuesday, February 14, 2012

default setting in RS

Hi,
Is anyway to set default setting in Reporting Service develop environment
.Net 2003?
For example, I want default the Font Properties as "Time New Roman, 12pt,
Bolder" in .Net,
so that I don't need to modify all of the font property during report edit.
Anyway or any idea can do this?
Thanks for reply! :)
AngiAngi,
You can't edit the designer default, but:
Report designer has style templates that you can use with the report wizard.
You can alter existing templates (bold, casual, corporate, compact) or add
new ones by editing the styletemplates.xml file in the
\90\tools\binn\vsshell\common7\ide\business intelligence
wizards\reports\styles folder within the SQL Server progam folder.
This way you can make your own template for designing you own reports.
Please use your full name when posting to these newsgroups.
Jon Jahren
"angi" <angi@.microsoft.public.sqlserver.olap> wrote in message
news:euNzzZ7xEHA.4052@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Is anyway to set default setting in Reporting Service develop environment
> .Net 2003?
> For example, I want default the Font Properties as "Time New Roman, 12pt,
> Bolder" in .Net,
> so that I don't need to modify all of the font property during report
edit.
> Anyway or any idea can do this?
> Thanks for reply! :)
> Angi
>

Default rendering by report.

Hi All,
Is it possible in RS 2000/2005 to specify a default rendering by
report, within the report manager web page. For example i have a data
extract that users will dump into execl/access so they never want to
see a pretty html rendering so i want that to go straight to csv, other
reports may render straight to pdf or html. I realise i could acheive
this by creating my own report manager, but i think this is quite a
sensible option to expect from the MS report manager.
Thanks for any assistance.
BenI have a user who only likes Excel.
So I created a report that doesn't read any data but consists of some
textboxes. They're formatted in a fancy way to look like buttons. In
the properties | Navigation tab of the textbox I navigate to a URL
which is the "URL access" form (look this up in BOL) for running
reports, from which you can specify parameters, rendering formats, how
much of the RS interface is shown (i.e. parameters, toolbars, document
maps etc.)
It's easy to do and requires no more than for you to look up the URL
access syntax. My user is very happy with this arrangement!
--
Regards
Chris
benaud@.gmail.com wrote:
> Hi All,
> Is it possible in RS 2000/2005 to specify a default rendering by
> report, within the report manager web page. For example i have a data
> extract that users will dump into execl/access so they never want to
> see a pretty html rendering so i want that to go straight to csv,
> other reports may render straight to pdf or html. I realise i could
> acheive this by creating my own report manager, but i think this is
> quite a sensible option to expect from the MS report manager.
> Thanks for any assistance.
> Ben|||Thanks Chris, This is a nice workaround cause it maintains the security
of the report manager... If theres no in-built way of doing what i
want then I will set it up like you suggest. But don't you agree that
the default rendering should be configurable by report?
Ben|||Oh yes, I do agree. There is a wishlist somewhere on microsofts web
site!
--
Regards
Chris
benaud@.gmail.com wrote:
> Thanks Chris, This is a nice workaround cause it maintains the
> security of the report manager... If theres no in-built way of doing
> what i want then I will set it up like you suggest. But don't you
> agree that the default rendering should be configurable by report?
> Ben