Friday, March 30, 2012
OPENQUERY Returning only 2 Rows
The sentence that reads, "After I changed it to 0, I was able to get..." should say, "After I changed it to 1 , I was able to get all of the records."|||Thanks for posting the solution. :)
OpenQuery not working after applyin SQL Server SP4
Issue:
We have Linked Server setup to OLAP Server. which was working fine for long time. After applying SP4 on SQL Server, we started getting this error. But the same query runs from another server with SP3.
After applying SP4, I have also applied 2 hotfixes to SQL Server. One hot fix is related to using using memory more than 3GB and another hotfix is for this Linked server issue. but still I have the problem.
SELECT * FROM openquery( OLAP_PLS,'SELECT { [Measures].[Produced Qty] } ON COLUMNS , { [Time].[Year].&[2007].&[1].&[2] } ON ROWS FROM [Employee]')
Error:
Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'MSOLAP' reported an error.
[OLE/DB provider returned message: Database 'PLS' does not exist.]
OLE DB error trace [OLE/DB Provider 'MSOLAP' IDBInitialize::Initialize returned 0x80004005: ].
Appreciate your help.
Thanks,
Varad
sqlWednesday, March 28, 2012
Opening Table in Management Studio is very slow
Dear Gurus
When I open a large table (say more than 1,000,000 Rows) in the SSMS by right clicking on the table name, it takes a very big time to fully open the table.More than 20 minutes for 1,000,000 records on a local instance.
SQL Server 2000 EM was extremely faster. Does any one knows a work around?
I need to be able to view and edit the data in SSMS.
Thanks in advance.
Parviz
I do not suggest ever opening a large table like this and editing the data through management studio. It is better to write queries to view the data as needed, and dml statements to update the data as needed.Tim
Wednesday, March 21, 2012
Open table + NULLs
Am I doing something wrong?My first suggestion would be to use an UPDATE statement to modify data, not the resultset. After that, make sure you have highlighted the word "NULL" before you start typing... Those are nice work arounds, but it seems to me like this is not the behavior that should be happening in the UI. I don't think there is a code defect here. I think it's just the way the grid metaphor works. We tried to make sure our grid controls work the same as other Microsoft grids so that whatever learning people have invested in other Microsoft products applies to SQL Server and Visual Studio. The same thing you're describing here happens to me occasionally in other grid-centric products, such as the grid in Microsoft Excel. I've just had to learn to make sure the cell contents are completely highlighted before I start typing to replace them. In the case of the open table editor, once you change the cell contents, the open table editor replaces the DBNull value in the data set with whatever the cell contains. The open table editor doesn't know what you mean to have in the cell, so if you edit the cell contents to say "NULLnewdata", then that's what it changes the field data to. I see that this thread is ancient (in internet time!) but I have a highly similar question: I want to go the other way. That is, I want to NULLify a cell in the grid. Deleting the cell contents doesn't work (unless it's a char field) and typing 'NULL' doesn't work either (incorrect data type, or I get the string 'NULL' stored in the field). Is there any way to have a true NULL 'inserted' into a cell, through the grid control? Or can this only be done through DML? Thanks, Tom Tom, I don't think you can enter NULL values into a cell by typing something. However, there is a trick. You can either find another NULL value in the grid or go to the very last row of the grid where a bunch of NULLs are listed. Then just hit CTRL+C to copy the value and CTRL+V to paste it to the cell you want to add NULL to. Thanks!
> In SQL Management studio, if I right-click on a table and click "Open
> table", it brings up the table, similar to return all rows in 2000. But
> if I go to the last row, and edit data in a cell and the word "NULL" is
> that cell because there is a Null value there, it actually keeps the
> word null in there as in "NULLnewdata". >
> Am I doing something wrong?
>|||
> Those are nice work arounds, but it seems to me like this is not the
> behavior that should be happening in the UI. >
>|||"Correct" method or not, I am just confirming that this is a bug and someone else is having the same issue, and it was not because I have an old build or something.
(They did have 5 years to test it) :)|||To be quite honest, I'm not sure how much usability testing went into these parts of the tools... most of them are holdovers from Enterprise Manager, with a different look and feel. I was going to say prettier but I think the jury is still out on that one.
> "Correct" method or not, I am just confirming that this is a bug and
> someone else is having the same issue, and it was not because I have an
> old build or something.
> (They did have 5 years to test it) :)
>|||
1.) Ctrl-0 (read control-zero) = NULL
2.) Saying that that's the expected behavior is a cheap Cop-out. Enterprise Manager 2000 did it just fine. There is NO REASON that the "new" "improved" product can't clear out a cell with a null value as soon as it has the focus. I know it's Friday, but c`mon.
3.) One thing I've noticed is that Management Studio was obviously written *by* and *for* Visual Studio .NET programmers. All other developers (VB6, ASP, C, C++, SQL, MS Access...) got screwed. The one thing enterprise manager 2000 was good at was building queries. It did a good job. SQL Mgmt. Studio sucks at that. It does a horrible job. It takes me 20-30% longer to write queries in the new software. Let me run enterprise manager against SQL Server 2005 to build queries and I'll be a happy man.
Open table + NULLs
Am I doing something wrong?My first suggestion would be to use an UPDATE statement to modify data, not
the resultset.
After that, make sure you have highlighted the word "NULL" before you start
typing...
news:1305c385-434d-4f39-8ee2-993fecab5184@.discussions.microsoft.com... > In SQL Management studio, if I right-click on a table and click "Open > table", it brings up the table, similar to return all rows in 2000. But > if I go to the last row, and edit data in a cell and the word "NULL" is > that cell because there is a Null value there, it actually keeps the > word null in there as in "NULLnewdata". > > Am I doing something wrong? >||| Those are nice work arounds, but it seems to me like this is not the behavior that should be happening in the UI. value in Management Studio, it highlights the word. When I start typing, it replaces the word altogether. I can only reproduce your behavior if I highlight the cell, then click again. And I think had I happened upon that behavior naturally, I would have just remembered to not do it again. Sure, it's not the most intuitive thing in the world. But based on the number of people who are going to do it, my gut tells me that it will stay that way. You should still be using DML statements for modifying data, rather than relying on a GUI that is imperfect. Just because I can ride my tricycle to work doesn't make it the best choice. A news:c9dd504e-ee88-4d2e-a773-24ae795050a5@.discussions.microsoft.com... > Those are nice work arounds, but it seems to me like this is not the > behavior that should be happening in the UI. > >|||"Correct" method or not, I am just confirming that this is a bug and someone else is having the same issue, and it was not because I have an old build or something. parts of the tools... most of them are holdovers from Enterprise Manager, with a different look and feel. I was going to say prettier but I think the jury is still out on that one. news:bc733a59-8d05-452c-ab75-9b9e0d570fa7@.discussions.microsoft.com... > "Correct" method or not, I am just confirming that this is a bug and > someone else is having the same issue, and it was not because I have an > old build or something. > (They did have 5 years to test it) :) >||| I don't think there is a code defect here. I think it's just the way the grid metaphor works. We tried to make sure our grid controls work the same as other Microsoft grids so that whatever learning people have invested in other Microsoft products applies to SQL Server and Visual Studio. The same thing you're describing here happens to me occasionally in other grid-centric products, such as the grid in Microsoft Excel. I've just had to learn to make sure the cell contents are completely highlighted before I start typing to replace them. In the case of the open table editor, once you change the cell contents, the open table editor replaces the DBNull value in the data set with whatever the cell contains. The open table editor doesn't know what you mean to have in the cell, so if you edit the cell contents to say "NULLnewdata", then that's what it changes the field data to. I see that this thread is ancient (in internet time!) but I have a highly similar question: I want to go the other way. That is, I want to NULLify a cell in the grid. Deleting the cell contents doesn't work (unless it's a char field) and typing 'NULL' doesn't work either (incorrect data type, or I get the string 'NULL' stored in the field). Is there any way to have a true NULL 'inserted' into a cell, through the grid control? Or can this only be done through DML? Thanks, Tom Tom, I don't think you can enter NULL values into a cell by typing something. However, there is a trick. You can either find another NULL value in the grid or go to the very last row of the grid where a bunch of NULLs are listed. Then just hit CTRL+C to copy the value and CTRL+V to paste it to the cell you want to add NULL to. Thanks! |||Three things. 1.) Ctrl-0 (read control-zero) = NULL 2.) Saying that that's the expected behavior is a cheap Cop-out. Enterprise Manager 2000 did it just fine. There is NO REASON that the "new" "improved" product can't clear out a cell with a null value as soon as it has the focus. I know it's Friday, but c`mon. 3.) One thing I've noticed is that Management Studio was obviously written *by* and *for* Visual Studio .NET programmers. All other developers (VB6, ASP, C, C++, SQL, MS Access...) got screwed. The one thing enterprise manager 2000 was good at was building queries. It did a good job. SQL Mgmt. Studio sucks at that. It does a horrible job. It takes me 20-30% longer to write queries in the new software. Let me run enterprise manager against SQL Server 2005 to build queries and I'll be a happy man.sql
(They did have 5 years to test it) :)|||To be quite honest, I'm not sure how much usability testing went into these
Monday, March 12, 2012
open cube to browse takes very long time
I broke up my cube into 24 partitions. There are about 630M total fact rows in that cube.
When I open the cube to browse in BIDS or SQL Management Studio it takes very long time to open (I think 30 minutes).
Profiler does not show that it's running a query, but messages like this keep appearing throughout the time it's opening to browse:
Progress Report Begin, 14- Query, Started reading data from the 'p0' partition.
Progress Report End, 14- Query, Finished reading data from the 'p0' partition.
Progress Report Begin, 14- Query, Started reading data from the 'p10' partition.
Progress Report End, 14- Query, Finished reading data from the 'p10' partition.
and goes on like that....
Looks like you have quite a bit data in your cube. Try designing aggregations for your cube to speed any operations.
Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Thank you, yes, adding more aggregations helped opening the cube faster.
A follow up question - based on cube performance in the future is there a way to
Find long running AS queries in trace|||
For that setup a quiery log (http://www.microsoft.com/technet/prodtechnol/sql/2005/technologies/config_ssas_querylog.mspx)
And then use "Usage-Based optimization" wizard to tune your aggregations for longest running queries.
HTH
Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
select filter([Measures].members, [Measures].currentmember.member_caption = [Measures].currentmember.member_caption) on columns from [MYCUBE]
After during that query, I see that from each partition SSAS reads from the same aggregation:
(this repeats for each partition)
Finished reading data from the 'Aggregation 3f' aggregation.
This aggregation includes one attribute each from 2 dimensions out of 19 total dimensions.
The query I provided above does not query by any particular dimension.
So my question is, can I create a single specific aggregation in my design which will always ensure that cube is opened for browsing without a huge delay?
(or is it safest to just copy this specific aggregation and make sure it's always included).
The reason I ask is that I want to reduce the number of aggregations in my design to improve processing time, but I don't want to remove aggregations that might be needed to open the cube quickly.|||
While we're on this subject, does anyone from Microsoft know why the cube browser decides to retrieve all the measures with their cell values? Why not just:
select {} on columns,
[Measures].members on rows
from [Adventure Works]
That way I don't think it will actually retrieve the cell value, just the measure names.
|||While we're on this subject, does anyone from Microsoft know why the cube browser decides to retrieve all the measures?
This is old limitation/design choice of OWC which is used by cube browser. It is unfortunate - I agree.
|||can anyone tell if I can create just one aggregation to make sure the browser can open cube quickly enough?what kind of aggregation is ideal for that?|||Yes - you can create a single aggregation which will include only non-aggregatable attributes and exclude all aggregatable attributes (assuming you didn't define any default members hitting aggregatable attributes - if you did - you will need to include them as well).|||Hi Mosha,
Yes
- you can create a single aggregation which will include only
non-aggregatable attributes and exclude all aggregatable attributes
What do you mean by a single aggregation? Are aggregatable attributes has the same meaning with aggregation usage?
FYI, I have the similar problem with performance issues. I have a cube with 40 dimensions. One of then has over than 5 millions members. I create aggregation based on attributes commonly used by users (I set the AggregationUsage for the attributes that are usually queried to be Unrestricted). I also make several partitions per month and each partition has about 2,5 million records. When I create aggregation design it created only 12%. I use MOLAP storage mode.
At the first I processed the data for 2 months and it went well. But after I processed the data for 2 years, the performance dropped. When I want to browse the cube, it takes so long. When I checked in the performance monitor, the I/O read was 100% but the memory that the SSAS use was only 2-3 GB (FYI, the server is 64 bit with memory 8GB).
I hope you or somebody else can help me...
Thanks in advance,
A. Imamuddin|||Ashari,
have you tried "Usage-Based Aggregation design". It is supposed to create aggregations based on the actual stored queries and their performance.
open cube to browse takes very long time
I broke up my cube into 24 partitions. There are about 630M total fact rows in that cube.
When I open the cube to browse in BIDS or SQL Management Studio it takes very long time to open (I think 30 minutes).
Profiler does not show that it's running a query, but messages like this keep appearing throughout the time it's opening to browse:
Progress Report Begin, 14- Query, Started reading data from the 'p0' partition.
Progress Report End, 14- Query, Finished reading data from the 'p0' partition.
Progress Report Begin, 14- Query, Started reading data from the 'p10' partition.
Progress Report End, 14- Query, Finished reading data from the 'p10' partition.
and goes on like that....
Looks like you have quite a bit data in your cube. Try designing aggregations for your cube to speed any operations.
Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Thank you, yes, adding more aggregations helped opening the cube faster.
A follow up question - based on cube performance in the future is there a way to
Find long running AS queries in trace|||
For that setup a quiery log (http://www.microsoft.com/technet/prodtechnol/sql/2005/technologies/config_ssas_querylog.mspx)
And then use "Usage-Based optimization" wizard to tune your aggregations for longest running queries.
HTH
Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
select filter([Measures].members, [Measures].currentmember.member_caption = [Measures].currentmember.member_caption) on columns from [MYCUBE]
After during that query, I see that from each partition SSAS reads from the same aggregation:
(this repeats for each partition)
Finished reading data from the 'Aggregation 3f' aggregation.
This aggregation includes one attribute each from 2 dimensions out of 19 total dimensions.
The query I provided above does not query by any particular dimension.
So my question is, can I create a single specific aggregation in my design which will always ensure that cube is opened for browsing without a huge delay?
(or is it safest to just copy this specific aggregation and make sure it's always included).
The reason I ask is that I want to reduce the number of aggregations in my design to improve processing time, but I don't want to remove aggregations that might be needed to open the cube quickly.|||
While we're on this subject, does anyone from Microsoft know why the cube browser decides to retrieve all the measures with their cell values? Why not just:
select {} on columns,
[Measures].members on rows
from [Adventure Works]
That way I don't think it will actually retrieve the cell value, just the measure names.
|||While we're on this subject, does anyone from Microsoft know why the cube browser decides to retrieve all the measures?
This is old limitation/design choice of OWC which is used by cube browser. It is unfortunate - I agree.
|||can anyone tell if I can create just one aggregation to make sure the browser can open cube quickly enough?what kind of aggregation is ideal for that?|||Yes - you can create a single aggregation which will include only non-aggregatable attributes and exclude all aggregatable attributes (assuming you didn't define any default members hitting aggregatable attributes - if you did - you will need to include them as well).|||Hi Mosha,
Yes
- you can create a single aggregation which will include only
non-aggregatable attributes and exclude all aggregatable attributes
What do you mean by a single aggregation? Are aggregatable attributes has the same meaning with aggregation usage?
FYI, I have the similar problem with performance issues. I have a cube with 40 dimensions. One of then has over than 5 millions members. I create aggregation based on attributes commonly used by users (I set the AggregationUsage for the attributes that are usually queried to be Unrestricted). I also make several partitions per month and each partition has about 2,5 million records. When I create aggregation design it created only 12%. I use MOLAP storage mode.
At the first I processed the data for 2 months and it went well. But after I processed the data for 2 years, the performance dropped. When I want to browse the cube, it takes so long. When I checked in the performance monitor, the I/O read was 100% but the memory that the SSAS use was only 2-3 GB (FYI, the server is 64 bit with memory 8GB).
I hope you or somebody else can help me...
Thanks in advance,
A. Imamuddin|||Ashari,
have you tried "Usage-Based Aggregation design". It is supposed to create aggregations based on the actual stored queries and their performance.
Wednesday, March 7, 2012
Only transform unique rows
I have created a SSIS package which includes a Data Flow that will transform my data. The Data Flow Source for this Data Flow is a SQL Server table with approx. 60 mill. rows. Theses rows ought to be unique but isn't quite, so I would like to ensure that only one of each row makes it throug to my Data Flow Destination, another SQL Server table.
What is the most efficient way to ensure this - is there some Data Flow Transformation that can assure this, should I write a SQL statement that deletes all duplicates before the Data Flow or should I take a third approch?
- SuneI can see two ways to do so:
1. OLE DB source -> Sort -> OLE DB dest
Configure Sort transform to "Remove rows with duplicate sort values".
2. OLE DB source -> Aggregate -> OLE DB dest
Configure Aggregate transform to group by all columns.
No.2 might be more efficient. Would you like to try and tell us the results? I'm very interested to know.|||Actually there is a third way and that is to use the T-SQL statement to do the dedupe. This can be much more efficient than either of the 2 mentioned above since the engine is optimized to do this especially if it can use an index. I think you would have to do some benchmarks to determine which is optimal for your particular scenario.
Thanks,
Matt|||I have actually been using a T-SQL statement up until now and I has been working okay. However all of a sudden performance have degraded significantly which made me wonder if there was any alternative ways.
I hope to get around to make some benchmarks during the weekend and promise to post the results.
Thanks for your help so far.
- Sune
only small subset of rows replicates to MySQL
However, when I try to replicate to a mySQL database however, only the same 152 rows get copied every time.
I compared rows that were copied to ones that were not to see if there was any obvious differences between the two and couldn't find any.
I have found these postings from 2005 that show some others having this issue. They are only in mySQL 4 where as I'm in 5:
http://www.sqlmonster.com/Uwe/Forum.aspx/sql-server-replication/7062/SQL-2000-to-MySQL-4-1-Transactional-Replication
Saturday, February 25, 2012
Only copy missing rows from one database to another
Hello everyone,
I'm trying to create a performant script to copy records from a table in a source database, to an identical table in a destination database.
In SQL 2000, I used to create a little lookup which did a count using certain fields. If the record was missing, I executed an INSERT query, otherwise an UPDATE query. The result was that the table on the destination side was always up to date. Duplicate rows were out of the question.
This was, if I'm not mistaking, a Data Transformation, using a bit of custom VBA code to govern the transfer. For each source row, the custom code was executed. Depending on the result of the custom code, a different query was launched.
Now I'm trying to do the same using SSIS in SQL 2005. Is there a task which does this for me, or do I have to script again? In the latter case, which type of task would I use?
(I thought of the Script Task, but then I would need to set up quite a bit myself.)
Thank you,
Bram
Look at the "checking to see if a record exists if so update else insert" post on the main page.http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1211340&SiteID=1
Only 9999 Rows after MERGE JOIN in SQL Server BIDS
I've gote 2 Tables with about 50.000 rows and I left outer join them with MERGE JOIN.
The result are 9999 rows. Has anybody got the same problem. Maybe it's a bug!?
Daniel Krebs wrote:
I've gote 2 Tables with about 50.000 rows and I left outer join them with MERGE JOIN.
The result are 9999 rows. Has anybody got the same problem. Maybe it's a bug!?
Merge joining is one of the trickiest components to use in SSIS. First make sure the data is sorted when it gets into the merge join; then you have to tell to the data flow pipeline how the data is sorted by changing some properties in the source component. Alternatively, you could place a Sort transform before the merge join; but that is resource consuming, so it may be better to use the DB engine if you are using tables. Then make sure the join type is properly set (you have to know your data).
Lastly, check some threads on this forum that talk about problem with Merge join and review BOL topics
http://forums.microsoft.com/MSDN/Search/Search.aspx?words=merge+join&localechoice=9&SiteID=1&searchscope=forumscope&ForumID=80
|||You may want to do the join as SQL query in your source adapter.only 1 data row shows up in preview - should have 10
select * from tbl1
tbl1 contains 10 rows and 6 fields. I have 6 textboxes in the layout view.
I linked each textbox to a field in the dataset. When I go to preview, I
only see one row of the 10 rows and only 1 page. What do I need to do to
show the rest of the rows (on the same page)? Any suggestions appreciated.
Thanks,
RichWell, I found part of my problem. When I right-click on a textbox I select
"expression" which brings up a dialog box with a variety of selections. I
want to select Fields but see a message that the report has not been linked
to a dataset. So I go to the Dataset option and select fields from there.
But each of those fields has the "First" function leading the expression.
So now my question is: how do you link a dataset to the report?
"Rich" wrote:
> I am relatively new to Reporting services. I have a real basic dataset
> select * from tbl1
> tbl1 contains 10 rows and 6 fields. I have 6 textboxes in the layout view.
> I linked each textbox to a field in the dataset. When I go to preview, I
> only see one row of the 10 rows and only 1 page. What do I need to do to
> show the rest of the rows (on the same page)? Any suggestions appreciated.
> Thanks,
> Rich|||I think I figured this out. You have to add a table to the layout from the
Toolbox and that is where select your dataset.
Just posting for posterity
"Rich" wrote:
> Well, I found part of my problem. When I right-click on a textbox I select
> "expression" which brings up a dialog box with a variety of selections. I
> want to select Fields but see a message that the report has not been linked
> to a dataset. So I go to the Dataset option and select fields from there.
> But each of those fields has the "First" function leading the expression.
> So now my question is: how do you link a dataset to the report?
>
> "Rich" wrote:
> > I am relatively new to Reporting services. I have a real basic dataset
> >
> > select * from tbl1
> >
> > tbl1 contains 10 rows and 6 fields. I have 6 textboxes in the layout view.
> > I linked each textbox to a field in the dataset. When I go to preview, I
> > only see one row of the 10 rows and only 1 page. What do I need to do to
> > show the rest of the rows (on the same page)? Any suggestions appreciated.
> >
> > Thanks,
> > Rich