Showing posts with label following. Show all posts
Showing posts with label following. Show all posts

Wednesday, March 28, 2012

How to arrive at Grand total?

Hi All,

My doubt is, how to get gand total in SQL Reporting Services2005 for the following scenario?

Sample report content:

CustomerId Product Name Price

123 Apple $100.00

Orange $77.00

SUB TOTAL $177.00

124 Apple $105.00

Orange $70.00

Olive $450.00

SUB TOTAL $625.00 // sum(Fields!Price)

GRAND TOTAL $802.00 //How to get Grand total? please..

Regards,

Pragash

put the expression "=sum(Fields!Price)" in the report footer

|||

Put it in the footer like in this way:Sum(Fields!Price,"Datset name").

Hope this helps.

|||

Hi Jon,

I tried with the following data but I am getting different result.

CustomerId Product Name Price

123 Apple $100.00

Orange $77.00

SUB TOTAL $177.00

124 Apple $105.00

Orange $70.00

Olive $450.00

SUB TOTAL $625.00

125 Apple $100.00

Orange $10.00

Olive $10.00

SUB TOTAL $120.00 // sum(Fields!Price.value)

GRAND TOTAL $328.00 // sum(Fields!Price.value) but it has to be $922.00 right but what its giving is subtotal2-subtotal1-subtotal3=$328.00 Why?

|||

Hi Mahima,

Its giving #Errr output when I used sum(Fields!Price,"Dataset_Name"), any other way?

|||

Hi ,

I am getting it now by puting sum(Fields!Price.Value) in the Table footer not in the report footer(page footer).

Thanks

Monday, March 26, 2012

How to apply sp4 to multiple instances that have different sp leve

I need to apply sp4 for SqlServer 2000 to the following instances all runnin
g
on the same server. The server is running Windows 2000.
SERVER Name: ABC01DB
SqlServer Instances follow:
Default 8.00.534 SP2 Developer Edition
DEV 8.00.760 SP3 Developer Edition
ABCDEV_APP01 (*) 8.00.194 RTM Developer Edition
ABCDEV_LT01 (*) 8.00.194 RTM Developer Edition
ABCDEV_LT02 (*) 8.00.194 RTM Developer Edition
ABCDEV_QA01 (*) 8.00.194 RTM Developer Edition
ABC_MGR 8.00.760 SP3 Developer Edition
Questions:
1) Do I need to apply any service packs other than sp4 to any of them prior
to applying sp4.
2) Is there any way to apply sp4 to multiple instances simultaneously or
must I apply sp4 separately for each instance.
3) Any suggestions or comments regarding the steps to simplify applying sp4
to all of the above instances.I proceeded with the upgrade and simply applied the sp4 to each instance,
starting with those which had no service packs first, (RTM). Then, I applie
d
it to the Default which was at sp2, and finally to those at sp3.
It all works.
"theWizard1" wrote:

> I need to apply sp4 for SqlServer 2000 to the following instances all runn
ing
> on the same server. The server is running Windows 2000.
> SERVER Name: ABC01DB
> SqlServer Instances follow:
> Default 8.00.534 SP2 Developer Edition
> DEV 8.00.760 SP3 Developer Edition
> ABCDEV_APP01 (*) 8.00.194 RTM Developer Edition
> ABCDEV_LT01 (*) 8.00.194 RTM Developer Edition
> ABCDEV_LT02 (*) 8.00.194 RTM Developer Edition
> ABCDEV_QA01 (*) 8.00.194 RTM Developer Edition
> ABC_MGR 8.00.760 SP3 Developer Edition
> Questions:
> 1) Do I need to apply any service packs other than sp4 to any of them pri
or
> to applying sp4.
> 2) Is there any way to apply sp4 to multiple instances simultaneously or
> must I apply sp4 separately for each instance.
> 3) Any suggestions or comments regarding the steps to simplify applying sp
4
> to all of the above instances.

How to apply sp4 to multiple instances that have different sp leve

I need to apply sp4 for SqlServer 2000 to the following instances all running
on the same server. The server is running Windows 2000.
SERVER Name: ABC01DB
SqlServer Instances follow:
Default 8.00.534 SP2 Developer Edition
DEV 8.00.760 SP3 Developer Edition
ABCDEV_APP01 (*) 8.00.194 RTM Developer Edition
ABCDEV_LT01 (*) 8.00.194 RTM Developer Edition
ABCDEV_LT02 (*) 8.00.194 RTM Developer Edition
ABCDEV_QA01 (*) 8.00.194 RTM Developer Edition
ABC_MGR 8.00.760 SP3 Developer Edition
Questions:
1) Do I need to apply any service packs other than sp4 to any of them prior
to applying sp4.
2) Is there any way to apply sp4 to multiple instances simultaneously or
must I apply sp4 separately for each instance.
3) Any suggestions or comments regarding the steps to simplify applying sp4
to all of the above instances.I proceeded with the upgrade and simply applied the sp4 to each instance,
starting with those which had no service packs first, (RTM). Then, I applied
it to the Default which was at sp2, and finally to those at sp3.
It all works.
"theWizard1" wrote:
> I need to apply sp4 for SqlServer 2000 to the following instances all running
> on the same server. The server is running Windows 2000.
> SERVER Name: ABC01DB
> SqlServer Instances follow:
> Default 8.00.534 SP2 Developer Edition
> DEV 8.00.760 SP3 Developer Edition
> ABCDEV_APP01 (*) 8.00.194 RTM Developer Edition
> ABCDEV_LT01 (*) 8.00.194 RTM Developer Edition
> ABCDEV_LT02 (*) 8.00.194 RTM Developer Edition
> ABCDEV_QA01 (*) 8.00.194 RTM Developer Edition
> ABC_MGR 8.00.760 SP3 Developer Edition
> Questions:
> 1) Do I need to apply any service packs other than sp4 to any of them prior
> to applying sp4.
> 2) Is there any way to apply sp4 to multiple instances simultaneously or
> must I apply sp4 separately for each instance.
> 3) Any suggestions or comments regarding the steps to simplify applying sp4
> to all of the above instances.sql

How to append records of one table to another?

Hi I have a table with the following structure:

Table1
---
Dept
Filed1
Filed2
Field3
Field4
Field5

I have another table with the following structure
(Basically this table will contain a subset of coloumns of Table1)

Table2
---
Dept
Field1
Field2

Now using a query I would like see all the records with all coloumns in Table1 plus all the records in Table2 appended

i.e
if Table1 row is

IT F1 F2 F3 F4 F5

and if Table2 row is

IT F11 F22
Sales F12 F23

I would like to see a result set with the following structure

Resultset

IT F1 F2 F3 F4 F5
IT F11 F22 NULL NULL NULL
Sales F12 F23 NULL NULL NULL

Can some body explain me how to do this with a query. I tried using union but it requires identical coloumns on both ends( Ofcourse, we can acheive this by having Field3,Field4 and Field5 as blank columns in Table 2 but I don't wanna do that as my original tables are too huge to handle this).

Any input is appreciated.

Thanks,
SaiOne ugly way to do it is:

select column1, column2, column3, column4, column5, column6 from table1
union
select column1, column2, column3, null, null, null from table2

Pain in the butt to do if you have a lot of columns but it will get you the rs back that you want.

Good luck.

Friday, March 23, 2012

How to alter column in Micorsoft SQL

Hi,
I have the following sample code to alter two table columns. But it
did not work. Please help me out. Thanks!
drop table one ;
create table one (
a float NOT NULL,
b varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
)
alter table one
alter column a (NULL) ,
alter column b (NULL)
;
Thanks,
Mike
On Feb 1, 2:09 am, "Michael" <michae...@.gmail.com> wrote:
> Hi,
> I have the following sample code to alter two table columns. But it
> did not work. Please help me out. Thanks!
> drop table one ;
> create table one (
> a float NOT NULL,
> b varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
> )
> alter table one
> alter column a (NULL) ,
> alter column b (NULL)
> ;
> Thanks,
> Mike
Hi Mike,
Perhaps you are not using Books Online properly.
The following code does what u wann.
ALTER TABLE ONE
ALTER COLUMN A FLOAT NULL
ALTER TABLE ONE
ALTER COLUMN B VARCHAR NULL
Thanks
Dutt...

How to alter column in Micorsoft SQL

Hi,
I have the following sample code to alter two table columns. But it
did not work. Please help me out. Thanks!
drop table one ;
create table one (
a float NOT NULL,
b varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
)
alter table one
alter column a (NULL) ,
alter column b (NULL)
;
Thanks,
MikeOn Feb 1, 2:09 am, "Michael" <michae...@.gmail.com> wrote:
> Hi,
> I have the following sample code to alter two table columns. But it
> did not work. Please help me out. Thanks!
> drop table one ;
> create table one (
> a float NOT NULL,
> b varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
> )
> alter table one
> alter column a (NULL) ,
> alter column b (NULL)
> ;
> Thanks,
> Mike
Hi Mike,
Perhaps you are not using Books Online properly.
The following code does what u wann.
ALTER TABLE ONE
ALTER COLUMN A FLOAT NULL
ALTER TABLE ONE
ALTER COLUMN B VARCHAR NULL
Thanks
Dutt...

How to alter column in Micorsoft SQL

Hi,
I have the following sample code to alter two table columns. But it
did not work. Please help me out. Thanks!
drop table one ;
create table one (
a float NOT NULL,
b varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
)
alter table one
alter column a (NULL) ,
alter column b (NULL)
;
Thanks,
MikeOn Feb 1, 2:09 am, "Michael" <michae...@.gmail.com> wrote:
> Hi,
> I have the following sample code to alter two table columns. But it
> did not work. Please help me out. Thanks!
> drop table one ;
> create table one (
> a float NOT NULL,
> b varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
> )
> alter table one
> alter column a (NULL) ,
> alter column b (NULL)
> ;
> Thanks,
> Mike
Hi Mike,
Perhaps you are not using Books Online properly.
The following code does what u wann.
ALTER TABLE ONE
ALTER COLUMN A FLOAT NULL
ALTER TABLE ONE
ALTER COLUMN B VARCHAR NULL
Thanks
Dutt...

How to alter a column

Hi,
What's wrong with the following code? Please help. I am using MS SQL
2000.
create table one (
a float NOT NULL,
b varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
)
alter table one
alter column a {drop} NOT NULL
alter column b {drop} NOT NULL
;
Thanks,
MikeSyntax usage is incorrect. Please use the below code to modify NOT NULL to NULL
alter table one alter column a Float NULL
alter table one alter column b Varchar(50) NULL
Thanks
Hari
"Michael" wrote:
> Hi,
> What's wrong with the following code? Please help. I am using MS SQL
> 2000.
> create table one (
> a float NOT NULL,
> b varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
> )
> alter table one
> alter column a {drop} NOT NULL
> alter column b {drop} NOT NULL
> ;
> Thanks,
> Mike
>

How to alter a column

Hi,
What's wrong with the following code? Please help. I am using MS SQL
2000.
create table one (
a float NOT NULL,
b varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
)
alter table one
alter column a {drop} NOT NULL
alter column b {drop} NOT NULL
;
Thanks,
MikeSyntax usage is incorrect. Please use the below code to modify NOT NULL to N
ULL
alter table one alter column a Float NULL
alter table one alter column b Varchar(50) NULL
Thanks
Hari
"Michael" wrote:

> Hi,
> What's wrong with the following code? Please help. I am using MS SQL
> 2000.
> create table one (
> a float NOT NULL,
> b varchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
> )
> alter table one
> alter column a {drop} NOT NULL
> alter column b {drop} NOT NULL
> ;
> Thanks,
> Mike
>

Monday, March 19, 2012

How to add sub-categories??

Hi all,

Can any body tell me how to add sub-categories to a database (MS SQL Server 2000) please.

I have a db with the following tables set:
Products: ProductID, CategoryID, ProductName
Categories: CategoryID, CategoryName

If a sub-category needs to be added how would I add it and what fields would it contain and the relationship between the Products and Category Table be?
Also any useful tips on this would be appreciated.

TIATIA,

If the sub-categories are the same as the categories you can just add a SubCategoryID field to your Products table. Then create a relationship between Category.CategoryID and Products.SubCategoryID.

Have some fun.|||Then does that mean i would have to add a Sub-Category Table... and the db would be like this:

Products: ProductsID, CategoryID, SubCategoryID...etc
Category: CatogeryID...etc
SubCategory: SubCategoryID...etc

the category table would have a 1-many relationship with products and a 1-many with sub-categories too?

For instance ... the products table would have books, games, music ...etc as products and books would have computers, history, science as it's sub-cats. games would have ps2, xbox ...etc as it's sub-cats.

So what would be the best way to describe the tabels and there relationships?|||I have found the best way to handle this is to have one table with an added field called 'parentID' or something like that. This value is the key on the row of the 'parent' category. This way, you can have unlimited subcategories.

Products: ProductsID, CategoryID, ...etc
Category: CatogeryID, ParentID, CategoryName, ...etc

Category Table (|seperator)
1 | 1 | 'Food & Clothing'
2 | 1 | 'Clothing'
3 | 2 | 'Shirts'
4 | 2 | 'Pants'
5 | 3 | 'Crew Neck T-Shirts'

Here we see that 'Crew Neck T-Shirts' is a sub category of 'Shirts', which is a sub category of 'Clothing', which is a sub category of 'Food & Clothing'. As you can see, this way allows for unlimited nesting of categories and is the best solution because a sub-category table would have the exact same information as the category table, so why duplicate the effort and over complicate the database?

Friday, March 9, 2012

How to add filter based on query?

Hi guys,

I have the following problem:
I have several tables in SQL 2005 ( table GeographicLocations and other related to it ). I created a cube in SSAS in which GeographicLocations is dimension.

I was able to add parameters but I need something more complicated: Having columns longitude and latitude in GeographicLocations I need to be able to return all locations within X (parameter) miles from passed GeographicLocation (parameter - GeographicLocationID )

I found SQL function that calculates distance from passed longitude and latitude of two points and T-SQL would like this:

declare @.GeoId int;
set @.GeoID = 200765;

select * from GeographicLocations as t1
where dbo.geo_distance(t1.longitude, t1.latitude,
(select longitude from GeographicLocations where id=@.GeoID),
(select latitude from GeographicLocations where id=@.GeoID)) < 2000

but how I can make same in SSAS and Reports?

Thanks in advance

I suggest making Longitude and Latitude related attributes of GeoLocation, and then implement SSAS sproc which computes difference between two points (similar to geo_distance).

|||

Hi Mosha,

Thank you very much for helping me.

I would like to ask you to be more specific as I am newbee in SSAS. Could you point me at some samples and resources that use such approach?

It is kind of blury to me how to create related attributes in such manner (although I read this article ), how to create SSAS stored procedure and how to call it from the report project

Best regards,

Galin

|||

Hi,

Any advise ? I'm dealing with the same problem and I'm also a newbie in SSAS.

I was thinking to make an user defined function in an assembly to compute the distance but I can't figure out if this will be viable.

Daniel.

|||I made .NET function to calculate distance - same as T-SQL one

also I made Longitude and Latitude measures and I could pass them in MDX query

Hope this helps|||

Hi,

Can you provide a sample of your MDX query ?

I was thinking that Lat and Long to be dimensions not measures.

Thnx.

daniel

|||

I've changed the fact table in order to have Latitude and Longitude as Measures; so now I have:

Measures(AggregateFunction)

PriceCount (Count),

Latitude (None),

Longitude (None)

Dimension

[Tbl DW Dim Property Type]

but from tests I've found that performing filter operations on Latitude/Longitude measures it is returning wrong results:

Code Snippet

SELECT

NON EMPTY { [Measures].[Prices Count] } ON COLUMNS,

NON EMPTY FILTER([Tbl DW Dim Property Type].[Name].Members, [Measures].[Latitude]>44.42659335504373) ON ROWS

FROM [DW DEV]

so I used an .NET sp to capture the data:

Code Snippet

SELECT

NON EMPTY { [Measures].[Prices Count] } ON COLUMNS,

NON EMPTY FILTER([Tbl DW Dim Property Type].[Name].Members, MDXClassLibrary.DoSomething([Measures].[Latitude])>44.42659335504373) ON ROWS

FROM [DW DEV]

Code Snippet

public static double DoSomething(double x)

{

return x;

}

And during debugging I’ve found that the sp’s parameter is receiving wrong values not the ones that are in [Measures].[Latitude].

I know that I'm missing something but I can't figure.

Any help would be appreciated.

|||

I've managed to run a query like this

Code Snippet

SELECT NON EMPTY { [Measures].[Prices Avg], [Measures].[Prices Max], [Measures].[Prices Min] } ON COLUMNS,

NON EMPTY { ([Tbl DW Dim Time].[Calendar Year].[Calendar Year].ALLMEMBERS *

[Tbl DW Dim Time].[Month Number Of Year].[Month Number Of Year].ALLMEMBERS ) }

DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS

FROM

( SELECT ( { FILTER([Tbl DW Dim Gis].[Coord].MEMBERS,

mdxclasslibrary.dist([Tbl DW Dim Gis].[Coord].CurrentMember.Name,

'44.42366640719915000000000','26.07366800308228000000000',1 )>0)}) ON COLUMNS

FROM (

SELECT ({[Tbl DW Dim Property Type].[Name].&[Apartment] } ) ON COLUMNS

FROM [DEV]))

but i noticed a significant performance degradation.

Any suggestions ?

How to add filter based on query?

Hi guys,

I have the following problem:
I have several tables in SQL 2005 ( table GeographicLocations and other related to it ). I created a cube in SSAS in which GeographicLocations is dimension.

I was able to add parameters but I need something more complicated: Having columns longitude and latitude in GeographicLocations I need to be able to return all locations within X (parameter) miles from passed GeographicLocation (parameter - GeographicLocationID )

I found SQL function that calculates distance from passed longitude and latitude of two points and T-SQL would like this:

declare @.GeoId int;
set @.GeoID = 200765;

select * from GeographicLocations as t1
where dbo.geo_distance(t1.longitude, t1.latitude,
(select longitude from GeographicLocations where id=@.GeoID),
(select latitude from GeographicLocations where id=@.GeoID)) < 2000

but how I can make same in SSAS and Reports?

Thanks in advance

I suggest making Longitude and Latitude related attributes of GeoLocation, and then implement SSAS sproc which computes difference between two points (similar to geo_distance).

|||

Hi Mosha,

Thank you very much for helping me.

I would like to ask you to be more specific as I am newbee in SSAS. Could you point me at some samples and resources that use such approach?

It is kind of blury to me how to create related attributes in such manner (although I read this article ), how to create SSAS stored procedure and how to call it from the report project

Best regards,

Galin

|||

Hi,

Any advise ? I'm dealing with the same problem and I'm also a newbie in SSAS.

I was thinking to make an user defined function in an assembly to compute the distance but I can't figure out if this will be viable.

Daniel.

|||I made .NET function to calculate distance - same as T-SQL one

also I made Longitude and Latitude measures and I could pass them in MDX query

Hope this helps|||

Hi,

Can you provide a sample of your MDX query ?

I was thinking that Lat and Long to be dimensions not measures.

Thnx.

daniel

|||

I've changed the fact table in order to have Latitude and Longitude as Measures; so now I have:

Measures(AggregateFunction)

PriceCount (Count),

Latitude (None),

Longitude (None)

Dimension

[Tbl DW Dim Property Type]

but from tests I've found that performing filter operations on Latitude/Longitude measures it is returning wrong results:

Code Snippet

SELECT

NON EMPTY { [Measures].[Prices Count] } ON COLUMNS,

NON EMPTY FILTER([Tbl DW Dim Property Type].[Name].Members, [Measures].[Latitude]>44.42659335504373) ON ROWS

FROM [DW DEV]

so I used an .NET sp to capture the data:

Code Snippet

SELECT

NON EMPTY { [Measures].[Prices Count] } ON COLUMNS,

NON EMPTY FILTER([Tbl DW Dim Property Type].[Name].Members, MDXClassLibrary.DoSomething([Measures].[Latitude])>44.42659335504373) ON ROWS

FROM [DW DEV]

Code Snippet

public static double DoSomething(double x)

{

return x;

}

And during debugging I’ve found that the sp’s parameter is receiving wrong values not the ones that are in [Measures].[Latitude].

I know that I'm missing something but I can't figure.

Any help would be appreciated.

|||

I've managed to run a query like this

Code Snippet

SELECT NON EMPTY { [Measures].[Prices Avg], [Measures].[Prices Max], [Measures].[Prices Min] } ON COLUMNS,

NON EMPTY { ([Tbl DW Dim Time].[Calendar Year].[Calendar Year].ALLMEMBERS *

[Tbl DW Dim Time].[Month Number Of Year].[Month Number Of Year].ALLMEMBERS ) }

DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS

FROM

( SELECT ( { FILTER([Tbl DW Dim Gis].[Coord].MEMBERS,

mdxclasslibrary.dist([Tbl DW Dim Gis].[Coord].CurrentMember.Name,

'44.42366640719915000000000','26.07366800308228000000000',1 )>0)}) ON COLUMNS

FROM (

SELECT ({[Tbl DW Dim Property Type].[Name].&[Apartment] } ) ON COLUMNS

FROM [DEV]))

but i noticed a significant performance degradation.

Any suggestions ?

How to add filter based on query?

Hi guys,

I have the following problem:
I have several tables in SQL 2005 ( table GeographicLocations and other related to it ). I created a cube in SSAS in which GeographicLocations is dimension.

I was able to add parameters but I need something more complicated: Having columns longitude and latitude in GeographicLocations I need to be able to return all locations within X (parameter) miles from passed GeographicLocation (parameter - GeographicLocationID )

I found SQL function that calculates distance from passed longitude and latitude of two points and T-SQL would like this:

declare @.GeoId int;
set @.GeoID = 200765;

select * from GeographicLocations as t1
where dbo.geo_distance(t1.longitude, t1.latitude,
(select longitude from GeographicLocations where id=@.GeoID),
(select latitude from GeographicLocations where id=@.GeoID)) < 2000

but how I can make same in SSAS and Reports?

Thanks in advance

I suggest making Longitude and Latitude related attributes of GeoLocation, and then implement SSAS sproc which computes difference between two points (similar to geo_distance).

|||

Hi Mosha,

Thank you very much for helping me.

I would like to ask you to be more specific as I am newbee in SSAS. Could you point me at some samples and resources that use such approach?

It is kind of blury to me how to create related attributes in such manner (although I read this article ), how to create SSAS stored procedure and how to call it from the report project

Best regards,

Galin

|||

Hi,

Any advise ? I'm dealing with the same problem and I'm also a newbie in SSAS.

I was thinking to make an user defined function in an assembly to compute the distance but I can't figure out if this will be viable.

Daniel.

|||I made .NET function to calculate distance - same as T-SQL one

also I made Longitude and Latitude measures and I could pass them in MDX query

Hope this helps|||

Hi,

Can you provide a sample of your MDX query ?

I was thinking that Lat and Long to be dimensions not measures.

Thnx.

daniel

|||

I've changed the fact table in order to have Latitude and Longitude as Measures; so now I have:

Measures(AggregateFunction)

PriceCount (Count),

Latitude (None),

Longitude (None)

Dimension

[Tbl DW Dim Property Type]

but from tests I've found that performing filter operations on Latitude/Longitude measures it is returning wrong results:

Code Snippet

SELECT

NON EMPTY { [Measures].[Prices Count] } ON COLUMNS,

NON EMPTY FILTER([Tbl DW Dim Property Type].[Name].Members, [Measures].[Latitude]>44.42659335504373) ON ROWS

FROM [DW DEV]

so I used an .NET sp to capture the data:

Code Snippet

SELECT

NON EMPTY { [Measures].[Prices Count] } ON COLUMNS,

NON EMPTY FILTER([Tbl DW Dim Property Type].[Name].Members, MDXClassLibrary.DoSomething([Measures].[Latitude])>44.42659335504373) ON ROWS

FROM [DW DEV]

Code Snippet

public static double DoSomething(double x)

{

return x;

}

And during debugging I’ve found that the sp’s parameter is receiving wrong values not the ones that are in [Measures].[Latitude].

I know that I'm missing something but I can't figure.

Any help would be appreciated.

|||

I've managed to run a query like this

Code Snippet

SELECT NON EMPTY { [Measures].[Prices Avg], [Measures].[Prices Max], [Measures].[Prices Min] } ON COLUMNS,

NON EMPTY { ([Tbl DW Dim Time].[Calendar Year].[Calendar Year].ALLMEMBERS *

[Tbl DW Dim Time].[Month Number Of Year].[Month Number Of Year].ALLMEMBERS ) }

DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS

FROM

( SELECT ( { FILTER([Tbl DW Dim Gis].[Coord].MEMBERS,

mdxclasslibrary.dist([Tbl DW Dim Gis].[Coord].CurrentMember.Name,

'44.42366640719915000000000','26.07366800308228000000000',1 )>0)}) ON COLUMNS

FROM (

SELECT ({[Tbl DW Dim Property Type].[Name].&[Apartment] } ) ON COLUMNS

FROM [DEV]))

but i noticed a significant performance degradation.

Any suggestions ?

how to add column in database at runtime.

Hello all,

I m trying to add a column in my database (it is a csv file)
but it is giving me following exception.
--exception----
{System.Data.OleDb.OleDbException}
ErrorCode: -2147467259
Errors: {System.Data.OleDb.OleDbErrorCollection}
HelpLink: Nothing
InnerException: Nothing
Message: "Operation not supported on a table that contains data."
Source: "Microsoft JET Database Engine"
StackTrace: " at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextE rrorHandling(Int32 hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextF orSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText( Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(Comm andBehavior behavior,
Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderIntern al(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()

Here is my code for this.
---Code-----
Dim ConnectString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\;Extended Properties=""text;HDR=Yes;FMT=Delimited"""
Dim myCon As New OleDbConnection(ConnectString)

Try

myCon.Open()
'Debug.WriteLine("Connection Opened")

Dim cmd As New OleDbCommand

cmd.CommandText = "ALTER TABLE [sample.csv] ADD mycol VARCHAR(50) NULL"
cmd.Connection = myCon
cmd.ExecuteNonQuery()

Catch ex As OleDbException
debug.WriteLine(ex.Message)
Finally
myCon.Close()
End Try

Any known reasons and workarounds??
Thanks & Regards.NetPointer (shaileshx.s.shah@.intel.com) writes:
> Message: "Operation not supported on a table that contains data."
> Source: "Microsoft JET Database Engine"
>...
> myCon.Open()
> 'Debug.WriteLine("Connection Opened")
> Dim cmd As New OleDbCommand
> cmd.CommandText = "ALTER TABLE [sample.csv] ADD mycol VARCHAR(50) NULL"
> cmd.Connection = myCon
> cmd.ExecuteNonQuery()
> Catch ex As OleDbException
> debug.WriteLine(ex.Message)
> Finally
> myCon.Close()
> End Try
> Any known reasons and workarounds??

The reason should be pretty clear from the message.

For a workaround, you may look for another newsgroup. This group is
focused on SQL Server, and we don't know that much about the Jet engine
or Excel here. Maybe they know more in comp.databases.ms-access.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Friday, February 24, 2012

How to achieve "On Error Resume Next" login in SSIS For Loop

Hello All,

I am developing a package using SSIS which needs to do the following.

1. Read all flat file from a folder. I am doing this using For Loop task. I know the total number of files in that folder hence I am setting the loop counter = file count.

2. The next step is to import the data from flat file to SQL server destination table using data flow task.

3. Upon successful completion of data flow task there are some other tasks like SQL to do some checks/validation on the data, export it to another tables.

Upon successful completion of step 3 the iteration goes to next file.

I want to achieve the following

IF step 2 has error (for example corrupt file or incomplete data), I want to fail data transfer completely, skip step 3, and go to step 1 for next available file and do rest.

How do I do this in SSIS?

Thanks for your help.

SGK

Hey SGK,

trying setting the maxerror count in properties to = 0

works for me, so it will keep going,

default is 1 so if an error occours it fails the whole thing

How to achieve "On Error Resume Next" login in SSIS For Loop

Hello All,

I am developing a package using SSIS which needs to do the following.

1. Read all flat file from a folder. I am doing this using For Loop task. I know the total number of files in that folder hence I am setting the loop counter = file count.

2. The next step is to import the data from flat file to SQL server destination table using data flow task.

3. Upon successful completion of data flow task there are some other tasks like SQL to do some checks/validation on the data, export it to another tables.

Upon successful completion of step 3 the iteration goes to next file.

I want to achieve the following

IF step 2 has error (for example corrupt file or incomplete data), I want to fail data transfer completely, skip step 3, and go to step 1 for next available file and do rest.

How do I do this in SSIS?

Thanks for your help.

SGK

Hey SGK,

trying setting the maxerror count in properties to = 0

works for me, so it will keep going,

default is 1 so if an error occours it fails the whole thing

Sunday, February 19, 2012

How to accomplish what I am trying to do?

Hello,

I need to write a package the does the following, and not sure the best approach:

The package will read a list of stored procedure names stored in a table. Then, for each stored procedure name, I need to run the stored procedure and save the output to a named file.

That is, run sp1 and output to file sp1.txt. That is, I need the name to reflect the name of the stored procedure.

Also, each time I create the new output file, I need to delete the old named file.

I'm sure this is a fairly straightforward task, but not sure how to do the "dynamic" file naming part.

Any help appreciated!!

Thank you

You can use an expression on your flat file connection manager to change the file name at runtime. Just set the ConnectionString property. To replace the file, make sure your Flat File destination has Overwrite data enabled.

Do all your stored procs return the same resultset? If not, using a data flow will probably not work for you, so you wouldn't be able to use a Flat File destination.

|||

Hi John,

You say that if my procs do not return the same result set a data flow will probably not work?

What can I use instead?

I am having serious problems trying to get the output from my stored procedure loops to flat files.

That is, I added a data flow task to the foreach loop, so that each execsql task will run a stored proc then write the output to a file. But it seems this is not possible?

I find it hard to believe... but is there a workaround?

|||You could use a custom script task inside your loop to execute the procedures, read the results, and write them to a file.

How to Accomplish This

If I have the following Data in a Table:
TranType Qty
1 10
1 20
2 15
3 7
What is the best way to accomplish this?
Type1 Type2 Type3
30 15 7
Thanks,
KFKeith,
if you've fixed trantype ie limited to 3 then following query will solve the purpose otherwise you
will have to
make use of dynamic crosstab using T-SQL.
--sample table and data.
create table #t(TranType int,Qty int)
insert into #t select 1, 10 union all
select 1 ,20 union all
select 2 ,15 union all
select 3 ,7
--Required query.
select sum(case trantype when 1 then qty else 0 end) type1,
sum(case trantype when 2 then qty else 0 end) type2,
sum(case trantype when 3 then qty else 0 end) type3
from #t
Refer to following url for dynamic crosstab solution.
http://www.sqlteam.com/item.asp?ItemID=2955
--
- Vishal|||"Vishal Parkar" wrote
.
.
> Refer to following url for dynamic crosstab solution.
> http://www.sqlteam.com/item.asp?ItemID=2955
Save yourself a lot of time and aggravation
and check out the RAC utility for all kinds of
crosstabs and pivoting:)
RAC v2.2 and QALite @.
www.rac4sql.net

How to access the SQL mobile database(.sdf) using ASP.Net?

How to access the SQL mobile database(.sdf) using ASP.Net?

When i try to add the System.Data.SqlServerCe.dll as a Reference it shows the following error.

Error 1 Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

You must browse to this folder: C:\Programmer\Microsoft SQL Server Compact Edition\v3.1 and add the reference from there. In addition, you must follow the instructions in this article http://msdn2.microsoft.com/en-us/library/system.data.sqlserverce.sqlceconnection.aspx if you want to use the SqlCeConnection. Also note the advice on performance problems with SQL CE and asp.net. Please not there is a documentation error, see here for the correct syntax:

http://msdn2.microsoft.com/en-us/library/ms174612.aspx