Showing posts with label including. Show all posts
Showing posts with label including. Show all posts

Monday, March 26, 2012

Query generates failures: Error 3624, Error 5180, or Error 823 when run without MAXDOP 1,

Posting the details of this situation so that others (including Microsoft)
are aware...
We had a simple query such as this on a multi-processor SQL Server:
SELECT count(*) FROM [Northwind].[dbo].[Orders] WHERE ShipRegion IS NULL
That would generate various severe errors (3624, 5180, 823), some of which
at first appeared to be hardware related. The errors were not generated if
the query were run with OPTION (MAXDOP 1). In the end a DBCC REINDEX of a
particular index on the table involved in the query fixed the problem,
although DBCC checks never indicated any problem with indexes.
Symptoms:
--
1. A stack dump indicating a failed assertion in file recbase.cpp
2. One of the following before the stack dump:
A. Error 3624 (retail assertion) of severity 20 (fatal error in current
process) that has follow-up message indicating the cause of the error, i.e.,
just "Error: 3624, Severity: 20, State: 1".
B. Error 5180 (could not open FCB for invalid file) of severity 22 (fatal
error, table integrity suspect) such as the following: "Error: 5180,
Severity: 22, State: 1 <next log entry> Could not open FCB for invalid file
ID 768 in database 'Northwind' ".
C. Error 823 (I/O error) of severity 24 (hardware error) such as the
following: "Error: 823, Severity: 24, State: 2 <new log entry> I/O error
38(Reached the end of the file.) detected during read at offset
0x00002000600000 in file 'C:\Program Files\Microsoft SQL
Server\MSSQL\Northwind.MDF' ".
3. The offending command that generated the initial failed assertion
continues to throw one of three errors listed above on subsequent
executions.
4. There are no hardware-related events in the Windows/NT Event Log.
5. The offending command uses parallelism.
6. When the offending command is run with OPTION (MAXDOP 1) to force serial
execution, it does not throw an error.
7. The following commands do not detect any integrity errors: DBCC
CHECKDB, DBCC CHECKCATALOG, DBCC CHECKTABLE (table only or table plus index
arguments), and DBCC CHECKFILEGROUP.
Investigation Notes:
--
1. Issue came up with the following statement sql statement
SELECT count(*) FROM [Northwind].[dbo].[Orders] WHERE ShipRegion IS NULL
2. Adding OPTION (MAXDOP 1) brought back results
3. Adding WITH (NOLOCK) had no effect.
4. Individual column names were substituted for the * in the SELECT clause.
The results were mixed: some executions brought back results and others
returned one of the errors listed in the Symptoms above. Checking the
execution plans for all the variants using the MAXDOP option (so that the
actual plan could be retrieved, not just the planned one) revealed that the
failing ones all used a particular nonclustered index while the successful
ones used the clustered index.
5. When running the DBCC CHECK commands listed in the symptoms to try to
rectify the issue, the filegroup and indid of the problem index where used
where possible (in addition to the more generic executions with just a table
name). No DBCC commands revealed any integrity errors, though, regardless
of whether they used the table name or the table name plus the
filegroup/index.
Resolution:
--
DBCC REINDEX of the problematic index resolved the issue without
serialization of the query plan (MAXDOP 1). Once working, the actual
execution plan was checked to ensure it used parallelism; it did.
Subsequent tests with OPTION (MAXDOP 1) continued to work, as did the
inclusion/omission of locking hints like (NOLOCK).Hi Frank,
Thans for sharing your experience with MSDN Newsgroup!
Sincerely yours,
Mingqing Cheng
Microsoft Online Support
---
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks!

Friday, March 23, 2012

Query formatting in 2005 converted reports

Yikes! I have upgraded to SQL Server 2005 Developer Edition, including the
RS upgrade. The ReportServer and reports all came over and are running
fabulously well. However, strange things are happening with my queries in
Intelligence Studio (and VS Studio 2005, I've tried both) after being
converted to the new report definition format. My extensive queries have
been reformatted predominantly as straight-text (very unreadable) and my
queries no longer pass SQL verification.
I tried retrieving the well-formatted queries from local text file backups,
but the new designer continues to reformat it as straight-text.
What can I do to get the following format in my queries:
Select A,
B,
C (as string),
D
From TableA
Where [clause]
I'm querying against a MySQL 4.0 database with MyODBC 3.5.1 driver.
Thanks.
bhcHave you tried using the generic query designer (2 panes instead of 4). I
should leave it a alone. It is one of the buttons to the right of the ... to
switch to it).
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"bhc" <bhc@.discussions.microsoft.com> wrote in message
news:40DB9C60-A240-4B6E-9020-E79DEBEA613A@.microsoft.com...
> Yikes! I have upgraded to SQL Server 2005 Developer Edition, including
> the
> RS upgrade. The ReportServer and reports all came over and are running
> fabulously well. However, strange things are happening with my queries in
> Intelligence Studio (and VS Studio 2005, I've tried both) after being
> converted to the new report definition format. My extensive queries have
> been reformatted predominantly as straight-text (very unreadable) and my
> queries no longer pass SQL verification.
> I tried retrieving the well-formatted queries from local text file
> backups,
> but the new designer continues to reformat it as straight-text.
> What can I do to get the following format in my queries:
> Select A,
> B,
> C (as string),
> D
> From TableA
> Where [clause]
> I'm querying against a MySQL 4.0 database with MyODBC 3.5.1 driver.
> Thanks.
> bhc|||I get the following after converting to the new report definition format when
I access the Data tab:
Error in SELECT clause: alias not recognized.
Error in list of function arguments: 'DataCenter' not recognized.
Error in list of function arguments: ',' not recognized.
Error in list of function arguments: '<' not recognized.
Error in list of function arguments: 'out_month' not recognized.
Unable to parse query text.
If I let things load in the multi-pane view and use the Verify SQL button, a
Microsoft Visual Database Tools window pops up with "The command is not
supported by this provider".
Having reviewed a few of my report queries facing this issue, I notice
problems only with queries using native MySQL functions, such as date/time
conversions. All functions have been encapsulated by single quotes, so
instead of 60-SECOND(A.TIMESTAMP), I now have to contend with
60-'SECOND'(A.TIMESTAMP). Any attempts to remove them are futile; they
simply get inserted when I go to verify the SQL or move out of the Query text
pane. Though I get the above errors on other MySQL queries, I am still able
to run ones without functions in them.
Is there any way to configure RS to stop doing this? This is just nasty.
Thanks.
bhc
"Bruce L-C [MVP]" wrote:
> Have you tried using the generic query designer (2 panes instead of 4). I
> should leave it a alone. It is one of the buttons to the right of the ... to
> switch to it).
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "bhc" <bhc@.discussions.microsoft.com> wrote in message
> news:40DB9C60-A240-4B6E-9020-E79DEBEA613A@.microsoft.com...
> > Yikes! I have upgraded to SQL Server 2005 Developer Edition, including
> > the
> > RS upgrade. The ReportServer and reports all came over and are running
> > fabulously well. However, strange things are happening with my queries in
> > Intelligence Studio (and VS Studio 2005, I've tried both) after being
> > converted to the new report definition format. My extensive queries have
> > been reformatted predominantly as straight-text (very unreadable) and my
> > queries no longer pass SQL verification.
> >
> > I tried retrieving the well-formatted queries from local text file
> > backups,
> > but the new designer continues to reformat it as straight-text.
> >
> > What can I do to get the following format in my queries:
> > Select A,
> > B,
> > C (as string),
> > D
> > From TableA
> > Where [clause]
> >
> > I'm querying against a MySQL 4.0 database with MyODBC 3.5.1 driver.
> >
> > Thanks.
> > bhc
>
>|||Have you tried going to the generic query designer? I have no doubt you are
seeing these problems in the 4 pane graphical query designer. What happens
if you switch over to the generic query designer.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"bhc" <bhc@.discussions.microsoft.com> wrote in message
news:ABF940A7-4625-4F04-8A88-D26B05E8B78B@.microsoft.com...
>I get the following after converting to the new report definition format
>when
> I access the Data tab:
> Error in SELECT clause: alias not recognized.
> Error in list of function arguments: 'DataCenter' not recognized.
> Error in list of function arguments: ',' not recognized.
> Error in list of function arguments: '<' not recognized.
> Error in list of function arguments: 'out_month' not recognized.
> Unable to parse query text.
> If I let things load in the multi-pane view and use the Verify SQL button,
> a
> Microsoft Visual Database Tools window pops up with "The command is not
> supported by this provider".
> Having reviewed a few of my report queries facing this issue, I notice
> problems only with queries using native MySQL functions, such as date/time
> conversions. All functions have been encapsulated by single quotes, so
> instead of 60-SECOND(A.TIMESTAMP), I now have to contend with
> 60-'SECOND'(A.TIMESTAMP). Any attempts to remove them are futile; they
> simply get inserted when I go to verify the SQL or move out of the Query
> text
> pane. Though I get the above errors on other MySQL queries, I am still
> able
> to run ones without functions in them.
> Is there any way to configure RS to stop doing this? This is just nasty.
> Thanks.
> bhc
> "Bruce L-C [MVP]" wrote:
>> Have you tried using the generic query designer (2 panes instead of 4). I
>> should leave it a alone. It is one of the buttons to the right of the ...
>> to
>> switch to it).
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "bhc" <bhc@.discussions.microsoft.com> wrote in message
>> news:40DB9C60-A240-4B6E-9020-E79DEBEA613A@.microsoft.com...
>> > Yikes! I have upgraded to SQL Server 2005 Developer Edition, including
>> > the
>> > RS upgrade. The ReportServer and reports all came over and are running
>> > fabulously well. However, strange things are happening with my queries
>> > in
>> > Intelligence Studio (and VS Studio 2005, I've tried both) after being
>> > converted to the new report definition format. My extensive queries
>> > have
>> > been reformatted predominantly as straight-text (very unreadable) and
>> > my
>> > queries no longer pass SQL verification.
>> >
>> > I tried retrieving the well-formatted queries from local text file
>> > backups,
>> > but the new designer continues to reformat it as straight-text.
>> >
>> > What can I do to get the following format in my queries:
>> > Select A,
>> > B,
>> > C (as string),
>> > D
>> > From TableA
>> > Where [clause]
>> >
>> > I'm querying against a MySQL 4.0 database with MyODBC 3.5.1 driver.
>> >
>> > Thanks.
>> > bhc
>>|||Yes, I have tried using just the generic query designer (that's what I'm used
from RS 2000). It is the generic query designer where I'm having all the
problems. It's very unreadable and does not parse when MySQL functions are
used in the query even if the generic query designer is the only pane
displayed. The properties on Query Designer are as follows:
Distinct Values = No
Output All Columns= No
Query Parameter Identification = [nothing here]
Query Parameter List = [greyed out, no parameters specified]
Thoughts?
bhc
"Bruce L-C [MVP]" wrote:
> Have you tried going to the generic query designer? I have no doubt you are
> seeing these problems in the 4 pane graphical query designer. What happens
> if you switch over to the generic query designer.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "bhc" <bhc@.discussions.microsoft.com> wrote in message
> news:ABF940A7-4625-4F04-8A88-D26B05E8B78B@.microsoft.com...
> >I get the following after converting to the new report definition format
> >when
> > I access the Data tab:
> > Error in SELECT clause: alias not recognized.
> > Error in list of function arguments: 'DataCenter' not recognized.
> > Error in list of function arguments: ',' not recognized.
> > Error in list of function arguments: '<' not recognized.
> > Error in list of function arguments: 'out_month' not recognized.
> > Unable to parse query text.
> >
> > If I let things load in the multi-pane view and use the Verify SQL button,
> > a
> > Microsoft Visual Database Tools window pops up with "The command is not
> > supported by this provider".
> >
> > Having reviewed a few of my report queries facing this issue, I notice
> > problems only with queries using native MySQL functions, such as date/time
> > conversions. All functions have been encapsulated by single quotes, so
> > instead of 60-SECOND(A.TIMESTAMP), I now have to contend with
> > 60-'SECOND'(A.TIMESTAMP). Any attempts to remove them are futile; they
> > simply get inserted when I go to verify the SQL or move out of the Query
> > text
> > pane. Though I get the above errors on other MySQL queries, I am still
> > able
> > to run ones without functions in them.
> >
> > Is there any way to configure RS to stop doing this? This is just nasty.
> > Thanks.
> > bhc
> >
> > "Bruce L-C [MVP]" wrote:
> >
> >> Have you tried using the generic query designer (2 panes instead of 4). I
> >> should leave it a alone. It is one of the buttons to the right of the ...
> >> to
> >> switch to it).
> >>
> >>
> >> --
> >> Bruce Loehle-Conger
> >> MVP SQL Server Reporting Services
> >>
> >> "bhc" <bhc@.discussions.microsoft.com> wrote in message
> >> news:40DB9C60-A240-4B6E-9020-E79DEBEA613A@.microsoft.com...
> >> > Yikes! I have upgraded to SQL Server 2005 Developer Edition, including
> >> > the
> >> > RS upgrade. The ReportServer and reports all came over and are running
> >> > fabulously well. However, strange things are happening with my queries
> >> > in
> >> > Intelligence Studio (and VS Studio 2005, I've tried both) after being
> >> > converted to the new report definition format. My extensive queries
> >> > have
> >> > been reformatted predominantly as straight-text (very unreadable) and
> >> > my
> >> > queries no longer pass SQL verification.
> >> >
> >> > I tried retrieving the well-formatted queries from local text file
> >> > backups,
> >> > but the new designer continues to reformat it as straight-text.
> >> >
> >> > What can I do to get the following format in my queries:
> >> > Select A,
> >> > B,
> >> > C (as string),
> >> > D
> >> > From TableA
> >> > Where [clause]
> >> >
> >> > I'm querying against a MySQL 4.0 database with MyODBC 3.5.1 driver.
> >> >
> >> > Thanks.
> >> > bhc
> >>
> >>
> >>
>
>|||I am in the process of upgrading and testing all my reports. I will look at
some of the more complex ones that go against Sybase and see how it works.
I'll let you know.
--
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"bhc" <bhc@.discussions.microsoft.com> wrote in message
news:46E4343F-8FB0-4F09-A582-D7A3F5E9AF0A@.microsoft.com...
> Yes, I have tried using just the generic query designer (that's what I'm
> used
> from RS 2000). It is the generic query designer where I'm having all the
> problems. It's very unreadable and does not parse when MySQL functions
> are
> used in the query even if the generic query designer is the only pane
> displayed. The properties on Query Designer are as follows:
> Distinct Values = No
> Output All Columns= No
> Query Parameter Identification = [nothing here]
> Query Parameter List = [greyed out, no parameters specified]
> Thoughts?
> bhc
> "Bruce L-C [MVP]" wrote:
>> Have you tried going to the generic query designer? I have no doubt you
>> are
>> seeing these problems in the 4 pane graphical query designer. What
>> happens
>> if you switch over to the generic query designer.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "bhc" <bhc@.discussions.microsoft.com> wrote in message
>> news:ABF940A7-4625-4F04-8A88-D26B05E8B78B@.microsoft.com...
>> >I get the following after converting to the new report definition format
>> >when
>> > I access the Data tab:
>> > Error in SELECT clause: alias not recognized.
>> > Error in list of function arguments: 'DataCenter' not recognized.
>> > Error in list of function arguments: ',' not recognized.
>> > Error in list of function arguments: '<' not recognized.
>> > Error in list of function arguments: 'out_month' not recognized.
>> > Unable to parse query text.
>> >
>> > If I let things load in the multi-pane view and use the Verify SQL
>> > button,
>> > a
>> > Microsoft Visual Database Tools window pops up with "The command is not
>> > supported by this provider".
>> >
>> > Having reviewed a few of my report queries facing this issue, I notice
>> > problems only with queries using native MySQL functions, such as
>> > date/time
>> > conversions. All functions have been encapsulated by single quotes, so
>> > instead of 60-SECOND(A.TIMESTAMP), I now have to contend with
>> > 60-'SECOND'(A.TIMESTAMP). Any attempts to remove them are futile; they
>> > simply get inserted when I go to verify the SQL or move out of the
>> > Query
>> > text
>> > pane. Though I get the above errors on other MySQL queries, I am still
>> > able
>> > to run ones without functions in them.
>> >
>> > Is there any way to configure RS to stop doing this? This is just
>> > nasty.
>> > Thanks.
>> > bhc
>> >
>> > "Bruce L-C [MVP]" wrote:
>> >
>> >> Have you tried using the generic query designer (2 panes instead of
>> >> 4). I
>> >> should leave it a alone. It is one of the buttons to the right of the
>> >> ...
>> >> to
>> >> switch to it).
>> >>
>> >>
>> >> --
>> >> Bruce Loehle-Conger
>> >> MVP SQL Server Reporting Services
>> >>
>> >> "bhc" <bhc@.discussions.microsoft.com> wrote in message
>> >> news:40DB9C60-A240-4B6E-9020-E79DEBEA613A@.microsoft.com...
>> >> > Yikes! I have upgraded to SQL Server 2005 Developer Edition,
>> >> > including
>> >> > the
>> >> > RS upgrade. The ReportServer and reports all came over and are
>> >> > running
>> >> > fabulously well. However, strange things are happening with my
>> >> > queries
>> >> > in
>> >> > Intelligence Studio (and VS Studio 2005, I've tried both) after
>> >> > being
>> >> > converted to the new report definition format. My extensive queries
>> >> > have
>> >> > been reformatted predominantly as straight-text (very unreadable)
>> >> > and
>> >> > my
>> >> > queries no longer pass SQL verification.
>> >> >
>> >> > I tried retrieving the well-formatted queries from local text file
>> >> > backups,
>> >> > but the new designer continues to reformat it as straight-text.
>> >> >
>> >> > What can I do to get the following format in my queries:
>> >> > Select A,
>> >> > B,
>> >> > C (as string),
>> >> > D
>> >> > From TableA
>> >> > Where [clause]
>> >> >
>> >> > I'm querying against a MySQL 4.0 database with MyODBC 3.5.1 driver.
>> >> >
>> >> > Thanks.
>> >> > bhc
>> >>
>> >>
>> >>
>>|||The way the generic query designer works for me is it leaves everything
exactly the way I type it in. If it has been in the graphical designer it
can get munged up. If you clean it up it should work for you.
The properties you mentioned, I don't see anyplace to see these properties?
Where are you seeing them?
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:%238%23y%23UW5FHA.724@.TK2MSFTNGP14.phx.gbl...
>I am in the process of upgrading and testing all my reports. I will look at
>some of the more complex ones that go against Sybase and see how it works.
>I'll let you know.
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
>
> "bhc" <bhc@.discussions.microsoft.com> wrote in message
> news:46E4343F-8FB0-4F09-A582-D7A3F5E9AF0A@.microsoft.com...
>> Yes, I have tried using just the generic query designer (that's what I'm
>> used
>> from RS 2000). It is the generic query designer where I'm having all the
>> problems. It's very unreadable and does not parse when MySQL functions
>> are
>> used in the query even if the generic query designer is the only pane
>> displayed. The properties on Query Designer are as follows:
>> Distinct Values = No
>> Output All Columns= No
>> Query Parameter Identification = [nothing here]
>> Query Parameter List = [greyed out, no parameters specified]
>> Thoughts?
>> bhc
>> "Bruce L-C [MVP]" wrote:
>> Have you tried going to the generic query designer? I have no doubt you
>> are
>> seeing these problems in the 4 pane graphical query designer. What
>> happens
>> if you switch over to the generic query designer.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>> "bhc" <bhc@.discussions.microsoft.com> wrote in message
>> news:ABF940A7-4625-4F04-8A88-D26B05E8B78B@.microsoft.com...
>> >I get the following after converting to the new report definition
>> >format
>> >when
>> > I access the Data tab:
>> > Error in SELECT clause: alias not recognized.
>> > Error in list of function arguments: 'DataCenter' not recognized.
>> > Error in list of function arguments: ',' not recognized.
>> > Error in list of function arguments: '<' not recognized.
>> > Error in list of function arguments: 'out_month' not recognized.
>> > Unable to parse query text.
>> >
>> > If I let things load in the multi-pane view and use the Verify SQL
>> > button,
>> > a
>> > Microsoft Visual Database Tools window pops up with "The command is
>> > not
>> > supported by this provider".
>> >
>> > Having reviewed a few of my report queries facing this issue, I notice
>> > problems only with queries using native MySQL functions, such as
>> > date/time
>> > conversions. All functions have been encapsulated by single quotes,
>> > so
>> > instead of 60-SECOND(A.TIMESTAMP), I now have to contend with
>> > 60-'SECOND'(A.TIMESTAMP). Any attempts to remove them are futile;
>> > they
>> > simply get inserted when I go to verify the SQL or move out of the
>> > Query
>> > text
>> > pane. Though I get the above errors on other MySQL queries, I am
>> > still
>> > able
>> > to run ones without functions in them.
>> >
>> > Is there any way to configure RS to stop doing this? This is just
>> > nasty.
>> > Thanks.
>> > bhc
>> >
>> > "Bruce L-C [MVP]" wrote:
>> >
>> >> Have you tried using the generic query designer (2 panes instead of
>> >> 4). I
>> >> should leave it a alone. It is one of the buttons to the right of the
>> >> ...
>> >> to
>> >> switch to it).
>> >>
>> >>
>> >> --
>> >> Bruce Loehle-Conger
>> >> MVP SQL Server Reporting Services
>> >>
>> >> "bhc" <bhc@.discussions.microsoft.com> wrote in message
>> >> news:40DB9C60-A240-4B6E-9020-E79DEBEA613A@.microsoft.com...
>> >> > Yikes! I have upgraded to SQL Server 2005 Developer Edition,
>> >> > including
>> >> > the
>> >> > RS upgrade. The ReportServer and reports all came over and are
>> >> > running
>> >> > fabulously well. However, strange things are happening with my
>> >> > queries
>> >> > in
>> >> > Intelligence Studio (and VS Studio 2005, I've tried both) after
>> >> > being
>> >> > converted to the new report definition format. My extensive
>> >> > queries
>> >> > have
>> >> > been reformatted predominantly as straight-text (very unreadable)
>> >> > and
>> >> > my
>> >> > queries no longer pass SQL verification.
>> >> >
>> >> > I tried retrieving the well-formatted queries from local text file
>> >> > backups,
>> >> > but the new designer continues to reformat it as straight-text.
>> >> >
>> >> > What can I do to get the following format in my queries:
>> >> > Select A,
>> >> > B,
>> >> > C (as string),
>> >> > D
>> >> > From TableA
>> >> > Where [clause]
>> >> >
>> >> > I'm querying against a MySQL 4.0 database with MyODBC 3.5.1 driver.
>> >> >
>> >> > Thanks.
>> >> > bhc
>> >>
>> >>
>> >>
>>
>|||If you right-click the generic query designer, there's an option for
Properties. Those are the properties I referenced in my previous email.
I have since been poring through the Tools | Options in Report Designer to
see if there's a way to turn off the automatic quotes and perhaps the
straight-text formatting. Any idea what these options might be? Maybe I can
customize Report Designer to behave the way I want/expect.
Thoughts?
"Bruce L-C [MVP]" wrote:
> The way the generic query designer works for me is it leaves everything
> exactly the way I type it in. If it has been in the graphical designer it
> can get munged up. If you clean it up it should work for you.
> The properties you mentioned, I don't see anyplace to see these properties?
> Where are you seeing them?
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
>
> "Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
> news:%238%23y%23UW5FHA.724@.TK2MSFTNGP14.phx.gbl...
> >I am in the process of upgrading and testing all my reports. I will look at
> >some of the more complex ones that go against Sybase and see how it works.
> >I'll let you know.
> >
> > --
> > Bruce Loehle-Conger
> > MVP SQL Server Reporting Services
> >
> >
> > "bhc" <bhc@.discussions.microsoft.com> wrote in message
> > news:46E4343F-8FB0-4F09-A582-D7A3F5E9AF0A@.microsoft.com...
> >> Yes, I have tried using just the generic query designer (that's what I'm
> >> used
> >> from RS 2000). It is the generic query designer where I'm having all the
> >> problems. It's very unreadable and does not parse when MySQL functions
> >> are
> >> used in the query even if the generic query designer is the only pane
> >> displayed. The properties on Query Designer are as follows:
> >> Distinct Values = No
> >> Output All Columns= No
> >> Query Parameter Identification = [nothing here]
> >> Query Parameter List = [greyed out, no parameters specified]
> >>
> >> Thoughts?
> >> bhc
> >>
> >> "Bruce L-C [MVP]" wrote:
> >>
> >> Have you tried going to the generic query designer? I have no doubt you
> >> are
> >> seeing these problems in the 4 pane graphical query designer. What
> >> happens
> >> if you switch over to the generic query designer.
> >>
> >>
> >> --
> >> Bruce Loehle-Conger
> >> MVP SQL Server Reporting Services
> >>
> >> "bhc" <bhc@.discussions.microsoft.com> wrote in message
> >> news:ABF940A7-4625-4F04-8A88-D26B05E8B78B@.microsoft.com...
> >> >I get the following after converting to the new report definition
> >> >format
> >> >when
> >> > I access the Data tab:
> >> > Error in SELECT clause: alias not recognized.
> >> > Error in list of function arguments: 'DataCenter' not recognized.
> >> > Error in list of function arguments: ',' not recognized.
> >> > Error in list of function arguments: '<' not recognized.
> >> > Error in list of function arguments: 'out_month' not recognized.
> >> > Unable to parse query text.
> >> >
> >> > If I let things load in the multi-pane view and use the Verify SQL
> >> > button,
> >> > a
> >> > Microsoft Visual Database Tools window pops up with "The command is
> >> > not
> >> > supported by this provider".
> >> >
> >> > Having reviewed a few of my report queries facing this issue, I notice
> >> > problems only with queries using native MySQL functions, such as
> >> > date/time
> >> > conversions. All functions have been encapsulated by single quotes,
> >> > so
> >> > instead of 60-SECOND(A.TIMESTAMP), I now have to contend with
> >> > 60-'SECOND'(A.TIMESTAMP). Any attempts to remove them are futile;
> >> > they
> >> > simply get inserted when I go to verify the SQL or move out of the
> >> > Query
> >> > text
> >> > pane. Though I get the above errors on other MySQL queries, I am
> >> > still
> >> > able
> >> > to run ones without functions in them.
> >> >
> >> > Is there any way to configure RS to stop doing this? This is just
> >> > nasty.
> >> > Thanks.
> >> > bhc
> >> >
> >> > "Bruce L-C [MVP]" wrote:
> >> >
> >> >> Have you tried using the generic query designer (2 panes instead of
> >> >> 4). I
> >> >> should leave it a alone. It is one of the buttons to the right of the
> >> >> ...
> >> >> to
> >> >> switch to it).
> >> >>
> >> >>
> >> >> --
> >> >> Bruce Loehle-Conger
> >> >> MVP SQL Server Reporting Services
> >> >>
> >> >> "bhc" <bhc@.discussions.microsoft.com> wrote in message
> >> >> news:40DB9C60-A240-4B6E-9020-E79DEBEA613A@.microsoft.com...
> >> >> > Yikes! I have upgraded to SQL Server 2005 Developer Edition,
> >> >> > including
> >> >> > the
> >> >> > RS upgrade. The ReportServer and reports all came over and are
> >> >> > running
> >> >> > fabulously well. However, strange things are happening with my
> >> >> > queries
> >> >> > in
> >> >> > Intelligence Studio (and VS Studio 2005, I've tried both) after
> >> >> > being
> >> >> > converted to the new report definition format. My extensive
> >> >> > queries
> >> >> > have
> >> >> > been reformatted predominantly as straight-text (very unreadable)
> >> >> > and
> >> >> > my
> >> >> > queries no longer pass SQL verification.
> >> >> >
> >> >> > I tried retrieving the well-formatted queries from local text file
> >> >> > backups,
> >> >> > but the new designer continues to reformat it as straight-text.
> >> >> >
> >> >> > What can I do to get the following format in my queries:
> >> >> > Select A,
> >> >> > B,
> >> >> > C (as string),
> >> >> > D
> >> >> > From TableA
> >> >> > Where [clause]
> >> >> >
> >> >> > I'm querying against a MySQL 4.0 database with MyODBC 3.5.1 driver.
> >> >> >
> >> >> > Thanks.
> >> >> > bhc
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
> >
> >
>
>sql

Friday, March 9, 2012

Query dbowner

Hi

We have a script that allows customers to change the users of the
database including the database owner. This script can be run at any
time. However, sometimes (and it really is only sometimes!) when the
following statement executes:

"exec sp_changedbowner @.USER_OWNER"

the following error is reported:

"The proposed new database owner is already a user in the database."

I have checked the other postings and the Books Online but cannot find
a way to query the current name of the dbowner i.e. the value of
@.USER_OWNER above. We have to be able to do this within the script so
that if the @.USER_OWNER variable is already the dbowner we do not
bother to execute the statement as otherwise this could display the
error. Can anybody help?

Thanks in Advance

PaulEM gets it from exec sp_MSdbuseraccess N'db', N'%'

which calls

select o.name, o.version, o.crdate, suser_sname(o.sid), o.dbid, o.status,
o.category, o.status2, DatabaseProperty(o.name, N'isfulltextenabled')
from master.dbo.sysdatabases o where o.name = @.qual

so

select suser_sname(o.sid) from master.dbo.sysdatabases where name = 'DBNAME'
should do it.

Danny

<paulwragg2323@.hotmail.com> wrote in message
news:1102498820.367939.212520@.f14g2000cwb.googlegr oups.com...
> Hi
> We have a script that allows customers to change the users of the
> database including the database owner. This script can be run at any
> time. However, sometimes (and it really is only sometimes!) when the
> following statement executes:
> "exec sp_changedbowner @.USER_OWNER"
> the following error is reported:
> "The proposed new database owner is already a user in the database."
> I have checked the other postings and the Books Online but cannot find
> a way to query the current name of the dbowner i.e. the value of
> @.USER_OWNER above. We have to be able to do this within the script so
> that if the @.USER_OWNER variable is already the dbowner we do not
> bother to execute the statement as otherwise this could display the
> error. Can anybody help?
> Thanks in Advance
> Paul|||This works fine (except missing o for alias for
master.dbo.sysdatabases) and is just what I needed.

Thanks Danny.|||This works fine (except missing o for alias for
master.dbo.sysdatabases) and is just what I needed.

Thanks Danny.|||One method to retrieve the current database owner:

DECLARE @.CurrentOwner nvarchar(256)
SELECT @.CurrentOwner = SUSER_SNAME(sid)
FROM master..sysdatabases
WHERE name = DB_NAME()

You can then conditionally change the owner:

IF @.CurrentOwner <> @.USER_OWNER
EXEC sp_changedbowner @.USER_OWNER

However, your error message is most likely because the new database owner is
a current database user rather than the database owner. The query below
will identify this condition as well as the database owner.

SELECT
l.name as LoginName,
u.name AS UserName
FROM master..syslogins l
JOIN sysusers u ON u.sid = l.sid
WHERE l.sid = SUSER_SID(@.USER_OWNER)

--
Hope this helps.

Dan Guzman
SQL Server MVP

<paulwragg2323@.hotmail.com> wrote in message
news:1102498820.367939.212520@.f14g2000cwb.googlegr oups.com...
> Hi
> We have a script that allows customers to change the users of the
> database including the database owner. This script can be run at any
> time. However, sometimes (and it really is only sometimes!) when the
> following statement executes:
> "exec sp_changedbowner @.USER_OWNER"
> the following error is reported:
> "The proposed new database owner is already a user in the database."
> I have checked the other postings and the Books Online but cannot find
> a way to query the current name of the dbowner i.e. the value of
> @.USER_OWNER above. We have to be able to do this within the script so
> that if the @.USER_OWNER variable is already the dbowner we do not
> bother to execute the statement as otherwise this could display the
> error. Can anybody help?
> Thanks in Advance
> Paul|||Thanks to both of you for replying to my post.
I have now solved this and proven that both methods will work.

Thanks.

Wednesday, March 7, 2012

query cannot return any results

I have a very uncommon problem ... I have a application that runs like this:
1) it receives users inserts, including a Status = 'U' field;
2) based on a Status field (index) the application query and select the last
inserted registries all day long, each 30 seconds;
3) every time it read the registries it changes the Status field to 'R'.
The problem is that after about 24 hours, the query identifies no longer
registries with that index. It returns nothing. I use a execurereader
command, and it happens that myreader.hasrows = false, even if there are row
s
with Status field = 'U'
Can somebody help me to know what is happening?
--
Sergio R Piresquery optimiser should use best available index or column stats to decide
strategy, and this may be cached for long period.
Maybe stats get recomputed automatically if you make lotsa changes and have
updatestats dboption set, or explicitly by your DBA [recommendation used to
be to do explicitly due to excessive overhead but nowadays with autonomics
MSSQL does the right thing].
If you truncate/delete staging table [daily] just before query is compiled
into cache it may decide to use tablescan even if index available [since so
_few_ rows] and this may persist some time even if cardinality builds up a
lot.
Unfortunately the sysindexes.rowcnt cannot be relied on for accuracy [due to
transaction activity], so you may have to force count(*) to get real count
but this has locking issues [nolock would only give approx count like
sysindexes].
Dependencies can be omitted from sysdepends [to support forward compilation]
so optimiser may be similarly ignorant.
I suspect the optimiser is getting , so suggest that
1. check latest Service Pack applied
2. exec sp_dboption 'pubs','auto create statistics','on' -- substitute
dbname for pubs
3. exec sp_dboption 'pubs','auto update statistics','on' -- substitute
dbname for pubs
4. use QA to show query plan [Control-L]
5. try explicit sp_recompile
6. check dependencies
if all else fails you can mark your sproc "WITH RECOMPILE" to ignore cached
copy, thus keep abreast of actual cardinality
best wishes!
Dick
"Sergio R Pires" wrote:

> I have a very uncommon problem ... I have a application that runs like thi
s:
> 1) it receives users inserts, including a Status = 'U' field;
> 2) based on a Status field (index) the application query and select the la
st
> inserted registries all day long, each 30 seconds;
> 3) every time it read the registries it changes the Status field to 'R'.
> The problem is that after about 24 hours, the query identifies no longer
> registries with that index. It returns nothing. I use a execurereader
> command, and it happens that myreader.hasrows = false, even if there are r
ows
> with Status field = 'U'
> Can somebody help me to know what is happening?
> --
> Sergio R Pires

Query Calculated Member - Member Properties

I have an urgent problem with some queries including calculated members where I want to filter by properties..

I have rewriten my query to show my issue on the Adventure Works Database.

Code Snippet

with

member [Account].[Accounts].[TEST] as 0

/* create a new query calculated member in the hierarchy */

select

{} on columns,

{

filter(

{

descendants([Account].[Accounts].&[1], 2)

,[Account].[Accounts].[TEST]

/* use the new calculated member */

/* comment out the calc member to see successfull execution */

},

[Account].[Accounts].CurrentMember.Properties("Account Type")="Assets"

/* filter by a member property which does not exists on the query calculated member - error */

)

}

dimension properties

[Account].[Accounts].[Account Type],

[Account].[Accounts].[Account Number],

[Account].[Accounts].[Accounts]

on rows

from

[Adventure Works]

I create a calcuated meber - and then I want to use this in a filter by member property. The Server always raises the error that the property does not exists.

How to solve this error?

The Documentation http://technet.microsoft.com/en-us/library/ms146017.aspx specify a possiblity to specify the property for the member - but I was not able to this - like documented It has no effect.

I need some urgent Help, HANNES

If you want filter to remove the calculated member then use stripcalculatedmembers function to remove all calculated members from the 1st argument. If you want filter to retain the calculated member then use the iserror function like below:

with

member [Account].[Accounts].[TEST] as 0

/* create a new query calculated member in the hierarchy */

select

{} on columns,

{

filter(

{

descendants([Account].[Accounts].&[1], 2)

,[Account].[Accounts].[TEST]

},

iserror([Account].[Accounts].CurrentMember.Properties("Account Type")) or [Account].[Accounts].CurrentMember.Properties("Account Type")="Assets"

/* filter by a member property which does not exists on the query calculated member - error */

)

}

dimension properties

[Account].[Accounts].[Account Type],

[Account].[Accounts].[Account Number],

[Account].[Accounts].[Accounts]

on rows

from

[Adventure Works]

|||

Hi,

my question - how do I proper specify a mdx property in the query calculated member.

I do not want to catch errors - nor produce errors - howto specifiy the property value in the query.

The documentation at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2126305&SiteID=1 mentions a syntax, but I can not get it work.

If I properly read the doc I would write it like

Code Snippet

with

member [Account].[Accounts].[TEST] as 0 ([Account].[Accounts].[Account Type]="Assets")

/* create a new query calculated member in the hierarchy */

select

But it dos not work.

Any ideas howto write?

HANNES

|||Calculated members don't support custom member properties. The document you mentioned shows you how to use pre-defined member properties, such as FORMAT_STRING, for calculated members.

Query Calculated Member - Member Properties

I have an urgent problem with some queries including calculated members where I want to filter by properties..

I have rewriten my query to show my issue on the Adventure Works Database.

Code Snippet

with

member [Account].[Accounts].[TEST] as 0

/* create a new query calculated member in the hierarchy */

select

{} on columns,

{

filter(

{

descendants([Account].[Accounts].&[1], 2)

,[Account].[Accounts].[TEST]

/* use the new calculated member */

/* comment out the calc member to see successfull execution */

},

[Account].[Accounts].CurrentMember.Properties("Account Type")="Assets"

/* filter by a member property which does not exists on the query calculated member - error */

)

}

dimension properties

[Account].[Accounts].[Account Type],

[Account].[Accounts].[Account Number],

[Account].[Accounts].[Accounts]

on rows

from

[Adventure Works]

I create a calcuated meber - and then I want to use this in a filter by member property. The Server always raises the error that the property does not exists.

How to solve this error?

The Documentation http://technet.microsoft.com/en-us/library/ms146017.aspx specify a possiblity to specify the property for the member - but I was not able to this - like documented It has no effect.

I need some urgent Help, HANNES

If you want filter to remove the calculated member then use stripcalculatedmembers function to remove all calculated members from the 1st argument. If you want filter to retain the calculated member then use the iserror function like below:

with

member [Account].[Accounts].[TEST] as 0

/* create a new query calculated member in the hierarchy */

select

{} on columns,

{

filter(

{

descendants([Account].[Accounts].&[1], 2)

,[Account].[Accounts].[TEST]

},

iserror([Account].[Accounts].CurrentMember.Properties("Account Type")) or [Account].[Accounts].CurrentMember.Properties("Account Type")="Assets"

/* filter by a member property which does not exists on the query calculated member - error */

)

}

dimension properties

[Account].[Accounts].[Account Type],

[Account].[Accounts].[Account Number],

[Account].[Accounts].[Accounts]

on rows

from

[Adventure Works]

|||

Hi,

my question - how do I proper specify a mdx property in the query calculated member.

I do not want to catch errors - nor produce errors - howto specifiy the property value in the query.

The documentation at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2126305&SiteID=1 mentions a syntax, but I can not get it work.

If I properly read the doc I would write it like

Code Snippet

with

member [Account].[Accounts].[TEST] as 0 ([Account].[Accounts].[Account Type]="Assets")

/* create a new query calculated member in the hierarchy */

select

But it dos not work.

Any ideas howto write?

HANNES

|||Calculated members don't support custom member properties. The document you mentioned shows you how to use pre-defined member properties, such as FORMAT_STRING, for calculated members.