Showing posts with label run. Show all posts
Showing posts with label run. Show all posts

Monday, March 26, 2012

Grouping Dimension Values

I have a question about grouping values in a dimension.

I have a dimension that relates to the age of a person. When I run my ETL we bring in the age as it was at the time of the load. When I display that age to my users in a report, I would like to group the ages according to internal usages.

Example: Age 16, 17, 18 would be grouped into a group of 16 to 18, etc....

This provides to us a larger statistic sample set, plus it makes the reports much easier to read.

I am using Reporting Services to generate reports, but I was looking to move the grouping logic away from the client to the Analysis Services server.

I actually have several dimensions like this where I would like to perform grouping.

I was considering using a Calculated Member to solve this, but wasn't sure if there was a cleaner solution.

Thanks in advance.

Bill

One solution is to do this by a named calculation in the data source view and create your groups with TSQL-CASE. In this way you will have full control over the groups.

The other way is to use the discretization method property of this attribute/column in the dimension editor. With this method you let SSAS create the groups with a little less flexibility than using a named calculation.

HTH

Thomas Ivarsson

|||

Thomas,

Thanks for the response.

I should have stated in my initial post that I am using AS 2000 not SSAS 2005.

Sorry for that.

Any ideas as to how to fix this solution into AS 2000?

Thanks in advance

Bill

|||

Use TSQL Case when you update your dimension table. Books On Line have good examples regarding case.

You can also wrap the TSQL case in you key and name columns, for the dimension level, in the dimension editor. This more of a dirty hack than fixing this in the dimension and your data source.

You can use views against the source table as well.

HTH

Thomas Ivarsson

Friday, March 23, 2012

Grouping by column alias

I'm trying to run a query and group by a calcuated column using its alias.
When I do, I get an error that says:
Server: Msg 207, Level 16, State 3, Line 2
Invalid column name 'WeekEnding'.
Here is the SQL code. Can someone tell me what is wrong with this.
select completionType,
(case datepart(dw,dateCompleted)
When 2 then dateAdd(dd,4,datecompleted)
When 3 then dateAdd(dd,3,datecompleted)
When 4 then dateAdd(dd,2,datecompleted)
When 5 then dateAdd(dd,1,datecompleted)
When 6 then dateAdd(dd,0,datecompleted)
end) as WeekEnding
--count(*)
From tblWorkQueue
where datecompleted is not null
group by completiontype, WeekEnding
order by weekendingThis is a multi-part message in MIME format.
--=_NextPart_000_00FE_01C396EF.A792ED00
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
You cannot use an alias in that context. However, you can use a derived =table to do the same thing:
select
completionType,
WeekEnding,
count(*)
from
(select completionType,
(case datepart(dw,dateCompleted)
When 2 then dateAdd(dd,4,datecompleted)
When 3 then dateAdd(dd,3,datecompleted)
When 4 then dateAdd(dd,2,datecompleted)
When 5 then dateAdd(dd,1,datecompleted)
When 6 then dateAdd(dd,0,datecompleted)
end) as WeekEnding
From tblWorkQueue
where datecompleted is not null
) as x
group by completiontype, WeekEnding
order by weekending
-- Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Jeff Czyzewski" <jeff@.red5poductions.com_NOSPAM> wrote in message =news:umg0xBxlDHA.3700@.TK2MSFTNGP11.phx.gbl...
I'm trying to run a query and group by a calcuated column using its =alias.
When I do, I get an error that says:
Server: Msg 207, Level 16, State 3, Line 2
Invalid column name 'WeekEnding'.
Here is the SQL code. Can someone tell me what is wrong with this.
select completionType,
(case datepart(dw,dateCompleted)
When 2 then dateAdd(dd,4,datecompleted)
When 3 then dateAdd(dd,3,datecompleted)
When 4 then dateAdd(dd,2,datecompleted)
When 5 then dateAdd(dd,1,datecompleted)
When 6 then dateAdd(dd,0,datecompleted)
end) as WeekEnding
--count(*)
From tblWorkQueue
where datecompleted is not null
group by completiontype, WeekEnding
order by weekending
--=_NextPart_000_00FE_01C396EF.A792ED00
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
&

You cannot use an alias in that =context. However, you can use a derived table to do the same thing:
select
completionType, WeekEnding,
count(*)from
(select =completionType, (case datepart(dw,dateCompleted) When 2 then dateAdd(dd,4,datecompleted) When 3 then dateAdd(dd,3,datecompleted) When 4 then dateAdd(dd,2,datecompleted) When 5 then dateAdd(dd,1,datecompleted) When 6 then dateAdd(dd,0,datecompleted) end) as WeekEndingFrom tblWorkQueuewhere datecompleted is not null) as =x
group by completiontype, WeekEndingorder by weekending
-- Tom
---T=homas A. Moreau, BSc, PhD, MCSE, MCDBASQL Server MVPColumnist, SQL =Server ProfessionalToronto, ON Canadahttp://www.pinnaclepublishing.com/sql">www.pinnaclepublishing.com=/sql
"Jeff Czyzewski" wrote in message news:umg0xBxlDHA.3700=@.TK2MSFTNGP11.phx.gbl...I'm trying to run a query and group by a calcuated column using its =alias.When I do, I get an error that says:Server: Msg 207, Level 16, State 3, =Line 2Invalid column name 'WeekEnding'.Here is the SQL code. =Can someone tell me what is wrong with this.select completionType, (case datepart(dw,dateCompleted) When =2 then dateAdd(dd,4,datecompleted) When 3 then dateAdd(dd,3,datecompleted) When 4 then dateAdd(dd,2,datecompleted) When 5 then dateAdd(dd,1,datecompleted) When 6 then dateAdd(dd,0,datecompleted) end) as WeekEnding --count(*)From tblWorkQueuewhere =datecompleted is not nullgroup by completiontype, WeekEndingorder by weekending

--=_NextPart_000_00FE_01C396EF.A792ED00--|||Jeff
Make a derived table
select completionType,WeekEnding
from
(
select completionType,
(case datepart(dw,dateCompleted)
When 2 then dateAdd(dd,4,datecompleted)
When 3 then dateAdd(dd,3,datecompleted)
When 4 then dateAdd(dd,2,datecompleted)
When 5 then dateAdd(dd,1,datecompleted)
When 6 then dateAdd(dd,0,datecompleted)
end) as WeekEnding
From tblWorkQueue
where datecompleted is not null
) as x
group by completionType,WeekEnding
--order by weekending
"Jeff Czyzewski" <jeff@.red5poductions.com_NOSPAM> wrote in message
news:umg0xBxlDHA.3700@.TK2MSFTNGP11.phx.gbl...
> I'm trying to run a query and group by a calcuated column using its alias.
> When I do, I get an error that says:
> Server: Msg 207, Level 16, State 3, Line 2
> Invalid column name 'WeekEnding'.
>
> Here is the SQL code. Can someone tell me what is wrong with this.
> select completionType,
> (case datepart(dw,dateCompleted)
> When 2 then dateAdd(dd,4,datecompleted)
> When 3 then dateAdd(dd,3,datecompleted)
> When 4 then dateAdd(dd,2,datecompleted)
> When 5 then dateAdd(dd,1,datecompleted)
> When 6 then dateAdd(dd,0,datecompleted)
> end) as WeekEnding
> --count(*)
> From tblWorkQueue
> where datecompleted is not null
> group by completiontype, WeekEnding
> order by weekending
>

Monday, March 12, 2012

Group by With count

Hi,
Iam using a count along with a group by condition. (Eg., Select count(col1),
col1 from table1 where col1 = <value> group by col1)
If I run the query and if no matching records if found the result doesnt sho
w anything. Why is this so?. But if I give
count(column) without the group by condition then a single record is fetched
based on no of records..
I not able to really see why the first one is not returning any records if t
he condition does not match.
Thanx in advance
regards
MaheshBasically, when the condition does not match, there is nothing is count (it
is a empty result set), which causes nothing to be displayed.
--
HTH,
SriSamp
Please reply to the whole group only!
http://www32.brinkster.com/srisamp
"Mahesh" <anonymous@.discussions.microsoft.com> wrote in message
news:0E67C7CE-7744-41D3-B733-17E6BF42E9E4@.microsoft.com...
quote:

> Hi,
> Iam using a count along with a group by condition. (Eg., Select

count(col1),col1 from table1 where col1 = <value> group by col1)
quote:

> If I run the query and if no matching records if found the result doesnt

show anything. Why is this so?. But if I give
quote:

> count(column) without the group by condition then a single record is

fetched based on no of records..
quote:

> I not able to really see why the first one is not returning any records if

the condition does not match.
quote:

>
> Thanx in advance
> regards
> Mahesh
>
|||If you want to see the count and the value of Col1 then you can do so like
this:
SELECT COUNT(*), <value>
FROM Table1
WHERE col1 = <value>
David Portas
--
Please reply only to the newsgroup
--

Group by With count

Hi,
Iam using a count along with a group by condition. (Eg., Select count(col1),col1 from table1 where col1 = <value> group by col1)
If I run the query and if no matching records if found the result doesnt show anything. Why is this so?. But if I give
count(column) without the group by condition then a single record is fetched based on no of records..
I not able to really see why the first one is not returning any records if the condition does not match.
Thanx in advance
regards
MaheshBasically, when the condition does not match, there is nothing is count (it
is a empty result set), which causes nothing to be displayed.
--
HTH,
SriSamp
Please reply to the whole group only!
http://www32.brinkster.com/srisamp
"Mahesh" <anonymous@.discussions.microsoft.com> wrote in message
news:0E67C7CE-7744-41D3-B733-17E6BF42E9E4@.microsoft.com...
> Hi,
> Iam using a count along with a group by condition. (Eg., Select
count(col1),col1 from table1 where col1 = <value> group by col1)
> If I run the query and if no matching records if found the result doesnt
show anything. Why is this so?. But if I give
> count(column) without the group by condition then a single record is
fetched based on no of records..
> I not able to really see why the first one is not returning any records if
the condition does not match.
>
> Thanx in advance
> regards
> Mahesh
>|||If you want to see the count and the value of Col1 then you can do so like
this:
SELECT COUNT(*), <value>
FROM Table1
WHERE col1 = <value>
--
David Portas
--
Please reply only to the newsgroup
--

Sunday, February 26, 2012

Group By Clause Help

Hello the code below shows multiple instances of targets.name "donor type" I could not correclty run the code without including contributions.program. I would like the output to only have 1 value for each donor type. How would I do this or workaround to get it done?

- thanks for your time.

SQL> SELECT targets.name "DONOR TYPE", contribution.program,
2 SUM(contribution.amount) "CONTRIBUTION QTR2"
3 FROM donor, contribution, targets
4 WHERE contribution.cdate >= TO_DATE('04/01/03', 'MM/DD/YY')
5 AND contribution.cdate <= TO_DATE('06/30/03', 'MM/DD/YY')
6 AND donor.donor = contribution.donor
7 AND targets.type = donor.type
8 GROUP BY targets.name, contributions.program;

DONOR TYPE PROGRAM CONTRIBUTION QTR2
------- -------- ------
Corporate Donors Applied Research 100
Foundations Applied Research 175
Individuals Basic Research 50
Corporate Donors International Programs 100
Corporate Donors Teaching Programs 50
Foundations Teaching Programs 50What prevents you from doing this?:

SQL> SELECT targets.name "DONOR TYPE",
2 SUM(contribution.amount) "CONTRIBUTION QTR2"
3 FROM donor, contribution, targets
4 WHERE contribution.cdate >= TO_DATE('04/01/03', 'MM/DD/YY')
5 AND contribution.cdate <= TO_DATE('06/30/03', 'MM/DD/YY')
6 AND donor.donor = contribution.donor
7 AND targets.type = donor.type
8 GROUP BY targets.name;

DONOR TYPE CONTRIBUTION QTR2
------- ------
Corporate Donors 250
Foundations 225
Individuals 50|||How can I get tthe output to look like this?

DONOR TYPE PROGRAM CONTRIBUTION QTR2
------- -------- ------
Corporate Donors Applied Research 100
International Programs 100
Teaching Programs 50

Foundations Applied Research 175
Teaching Programs 50
Individuals Basic Research 50

- thanks for your help|||Oh I see, you mean suppress the output of the repeated value?

In SQL Plus, use:

SQL> BREAK ON "DONOR TYPE"

Also, add "ORDER BY targets.name, contributions.program" after the GROUP BY clause to be sure the ordering is correct (GROUP BY doesn't guarantee the order).|||Great this worked for that table--thanks a bunch. How can I group by contrubuion by member only so there is only one isntance per name and the sum of all rows info and still maintain each of the columns. this can be easily done by removing the target column but I need to display it along with the others belwo. Once put the target column in I must also gruoup by member.qtr1 which produces the multiple row output. How can I work around this to only group by member?

SQL> SELECT contribution.member, member.qtr1 "TARGET",
2 SUM(contribution.amount) "CONT. QTR1",
3 ROUND(SUM(contribution.amount)/member.qtr1,3)*10 "% OF PROJECTION"
4 FROM contribution, member
5 WHERE contribution.cdate >= TO_DATE('01/01/03', 'MM/DD/YY')
6 AND contribution.cdate <= TO_DATE('03/31/03', 'MM/DD/YY')
7 GROUP BY contribution.member, member.qtr1;

MEMBER TARGET CONT. QTR1 % OF PROJECTION
----- ---- ---- -----
Adams 50 175 35
Adams 75 175 23.33
Adams 100 175 17.5
Adams 150 175 11.67
Adams 200 175 8.75
Adams 250 175 7
Baker 50 100 20
Baker 75 100 13.33
Baker 100 100 10
Baker 150 100 6.67
Baker 200 100 5

Friday, February 24, 2012

Group by + 30

I want to run a select query with a group by like:

Select MyText, MyDate
From atest
Group By MyText, MyDate

However I want to group each "MyText" with the Min(MyDate) and Min(MyDate) + 30 days.

So for example I want to select 3 records with the same "MyText" value and the 3 records have MyDate values of 01/01/2005, 01/10/2005 and 03/01/2005 I would return 2 records because the first record would be grouped with the first 2 dates with the first date showing and the second record would be only 03/01/2005 because it didn't fall within 30 days.

How may I accomplish this?You probably want

GROUP BY DATEPART(mm,[date])

If you read the sticky at the top we could probably help you better|||I think he is going to need a cursor or a loop for this, since the value of each MIN() operation seems to be dependent upon the value of all the prior MIN() operations.

A very odd request. What is the purpose?|||U2FUNNY

That would mean every row could be part of 30 different result sets...which would be meaningless...|||I think his process is:
1) Find the minimum value.
2) Group all values in the next 30 days with it.
3) Find the next minum value that has not been included in a group.

I don't see how this could be done without a loop, as it is a non-linear algorithm.|||Yes, Blindman is correct in the approach. There actually other fields that will get added in so it makes more sense later. But I describe it with these 2 fields to make it easier to explain.|||If you would kindly read the sticky at the top of the forum and post some examples it would be a big help...in the manner that the sticky says...

Group Already Exists

I have run the "sp_change_user_logins" to create accounts that were already
lodged in a database to the new SQL server.
I have a Windows Group that I would like to recreate the SQL login for but I
get an error when I manually try to create the account stating that the
account already exists.
I don't see a Stored Procedure for the Groups other then "changegroup" but
that just changes a users setting for an existing group.
So the question is, HOw do I bring that Windows Group that already exists in
the database so that I can create a SQL logon for that Windows Group.
Thanks
Update your client tools to SP3a. You can then see 'orphaned' users,
including Windows-based users, in your database. You can then delete the
database user before re-adding it. 'sp_change_users_login' only allows you
to fix SQL-based logins.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"John E Davis" <JohnEDavis@.discussions.microsoft.com> wrote in message
news:B6D1B78F-29B5-4AAC-A2CE-FCF1D9D546CF@.microsoft.com...
> I have run the "sp_change_user_logins" to create accounts that were
already
> lodged in a database to the new SQL server.
> I have a Windows Group that I would like to recreate the SQL login for but
I
> get an error when I manually try to create the account stating that the
> account already exists.
> I don't see a Stored Procedure for the Groups other then "changegroup" but
> that just changes a users setting for an existing group.
> So the question is, HOw do I bring that Windows Group that already exists
in
> the database so that I can create a SQL logon for that Windows Group.
> Thanks

Group Already Exists

I have run the "sp_change_user_logins" to create accounts that were already
lodged in a database to the new SQL server.
I have a Windows Group that I would like to recreate the SQL login for but I
get an error when I manually try to create the account stating that the
account already exists.
I don't see a Stored Procedure for the Groups other then "changegroup" but
that just changes a users setting for an existing group.
So the question is, HOw do I bring that Windows Group that already exists in
the database so that I can create a SQL logon for that Windows Group.
ThanksUpdate your client tools to SP3a. You can then see 'orphaned' users,
including Windows-based users, in your database. You can then delete the
database user before re-adding it. 'sp_change_users_login' only allows you
to fix SQL-based logins.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"John E Davis" <JohnEDavis@.discussions.microsoft.com> wrote in message
news:B6D1B78F-29B5-4AAC-A2CE-FCF1D9D546CF@.microsoft.com...
> I have run the "sp_change_user_logins" to create accounts that were
already
> lodged in a database to the new SQL server.
> I have a Windows Group that I would like to recreate the SQL login for but
I
> get an error when I manually try to create the account stating that the
> account already exists.
> I don't see a Stored Procedure for the Groups other then "changegroup" but
> that just changes a users setting for an existing group.
> So the question is, HOw do I bring that Windows Group that already exists
in
> the database so that I can create a SQL logon for that Windows Group.
> Thanks

Group Already Exists

I have run the "sp_change_user_logins" to create accounts that were already
lodged in a database to the new SQL server.
I have a Windows Group that I would like to recreate the SQL login for but I
get an error when I manually try to create the account stating that the
account already exists.
I don't see a Stored Procedure for the Groups other then "changegroup" but
that just changes a users setting for an existing group.
So the question is, HOw do I bring that Windows Group that already exists in
the database so that I can create a SQL logon for that Windows Group.
ThanksUpdate your client tools to SP3a. You can then see 'orphaned' users,
including Windows-based users, in your database. You can then delete the
database user before re-adding it. 'sp_change_users_login' only allows you
to fix SQL-based logins.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"John E Davis" <JohnEDavis@.discussions.microsoft.com> wrote in message
news:B6D1B78F-29B5-4AAC-A2CE-FCF1D9D546CF@.microsoft.com...
> I have run the "sp_change_user_logins" to create accounts that were
already
> lodged in a database to the new SQL server.
> I have a Windows Group that I would like to recreate the SQL login for but
I
> get an error when I manually try to create the account stating that the
> account already exists.
> I don't see a Stored Procedure for the Groups other then "changegroup" but
> that just changes a users setting for an existing group.
> So the question is, HOw do I bring that Windows Group that already exists
in
> the database so that I can create a SQL logon for that Windows Group.
> Thanks

Sunday, February 19, 2012

GridView - SqlDataSource

I have created a GridView that uses a SqlDataSource. When I run the page it does not pull back any data. However when I test the query in the SqlDataSource dialog box it pulls back data.

Here is my GridView and SqlDataSource:

<

asp:GridViewID="Results"runat="server"AllowPaging="True"AllowSorting="True"CellPadding="2"EmptyDataText="No records found."AutoGenerateColumns="False"Width="100%"CssClass="tableResults"PageSize="20"DataSourceID="SqlResults"><Columns><asp:BoundFieldDataField="DaCode"HeaderText="Sub-Station"SortExpression="DaCode"><ItemStyleHorizontalAlign="Center"CssClass="tdResults"/><HeaderStyleHorizontalAlign="Center"CssClass="tdHeaderResults"/></asp:BoundField><asp:BoundFieldDataField="DpInfo"HeaderText="Delivery Point"SortExpression="DpInfo"><HeaderStyleHorizontalAlign="Left"CssClass="tdHeaderResults"/><ItemStyleCssClass="tdResults"/></asp:BoundField><asp:HyperLinkFieldDataNavigateUrlFields="CuCode,OrderID"DataNavigateUrlFormatString="TCCustDetail.asp?CuCode={0}&OrderID={1}"DataTextField="OrderID"HeaderText="Order No"SortExpression="OrderID"><ItemStyleCssClass="tdResults"HorizontalAlign="Center"/><HeaderStyleCssClass="tdHeaderResults"HorizontalAlign="Center"/></asp:HyperLinkField><asp:BoundFieldHeaderText="Order Date"SortExpression="OrderDate"DataField="OrderDate"><ItemStyleHorizontalAlign="Center"CssClass="tdResults"/><HeaderStyleHorizontalAlign="Center"CssClass="tdHeaderResults"/></asp:BoundField><asp:BoundFieldDataField="ReqDeliveryDate"HeaderText="Req Delivery Date"SortExpression="ReqDeliveryDate"><ItemStyleHorizontalAlign="Center"CssClass="tdResults"/><HeaderStyleHorizontalAlign="Center"CssClass="tdHeaderResults"/></asp:BoundField><asp:BoundFieldDataField="StatusDate"HeaderText="Status Date"SortExpression="StatusDate"><ItemStyleHorizontalAlign="Center"CssClass="tdResults"/><HeaderStyleHorizontalAlign="Center"CssClass="tdHeaderResults"/></asp:BoundField><asp:BoundFieldDataField="ManifestNo"HeaderText="Manifest No"SortExpression="ManifestNo"><ItemStyleHorizontalAlign="Center"CssClass="tdResults"/><HeaderStyleHorizontalAlign="Center"CssClass="tdHeaderResults"/></asp:BoundField><asp:BoundFieldDataField="CustomerPO"HeaderText="P.O. No"SortExpression="CustomerPO"><ItemStyleHorizontalAlign="Center"CssClass="tdResults"/><HeaderStyleHorizontalAlign="Center"CssClass="tdHeaderResults"/></asp:BoundField><asp:BoundFieldDataField="Class"HeaderText="Class"SortExpression="Class"><ItemStyleHorizontalAlign="Left"CssClass="tdResults"/><HeaderStyleHorizontalAlign="Left"CssClass="tdHeaderResults"/></asp:BoundField><asp:BoundFieldDataField="OrderStatus"HeaderText="Order Status"SortExpression="StatusSort"><ItemStyleHorizontalAlign="Left"CssClass="tdResults"/><HeaderStyleHorizontalAlign="Left"CssClass="tdHeaderResults"/></asp:BoundField></Columns><HeaderStyleForeColor="White"HorizontalAlign="Left"/><AlternatingRowStyleCssClass="tdResultsAltRowColor"/></asp:GridView><asp:SqlDataSourceID="SqlResults"runat="server"ConnectionString="<%$ ConnectionStrings:TransportationConnectionString %>"SelectCommand="GetOrderSummaryResults"SelectCommandType="StoredProcedure"><SelectParameters><asp:ParameterDefaultValue="10681"Name="CuCode"Type="String"/><asp:ParameterDefaultValue=""Name="DaCode"Type="String"/><asp:ParameterDefaultValue=""Name="DpCode"Type="String"/><asp:ParameterDefaultValue=""Name="OrderID"Type="String"/><asp:ParameterDefaultValue=""Name="ManifestNo"Type="String"/><asp:ParameterDefaultValue=""Name="PONo"Type="String"/></SelectParameters></asp:SqlDataSource>

I can get it to fill with data by manually filling the GridView without using a SqlDataSource but then I cannot get the sorting to work when I do it that way. Actually not sure if the sorting will work this way either as I cannot get it to fill with data. Any ideas would be much appreciated.

It doesn't appear as though your parameters are collecting any data in SqlDataSource. For instance, if you were storing your parameters in the querystring, you would have in your <asp:QueryParameter /> tags something such as QueryString="", or similar...

Grid view-cant update or delete

I put a grid view on a web form ,when I run it -the SELECT, EDIT works

the UPDATE,DELETE makes an error although I use the sama data,I added the error :

Anyone can help?

Server Error in '/CrystalReportsWebSite1' Application.

The data types text and nvarchar are incompatible in the equal to operator.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: The data types text and nvarchar are incompatible in the equal to operator.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[SqlException (0x80131904): The data types text and nvarchar are incompatible in the equal to operator.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +95 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +82 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3244 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +186 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1121 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +334 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +407 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +149 System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +493 System.Web.UI.WebControls.SqlDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues) +915 System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +179 System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1140

Hey,

What does those update/delete stored procedures look like? It seems like it may be an issue with the query.

|||I'm guessing he has a text field, and he told it to use optimistic concurrency or (CompareAllValues), which doesn't work with text fields.

Grid results in Management Studio

Hi
When I run a query in Management Studio, I get this message -
The query has exceeded the maximum number of result sets that can be
displayed in the results grid. Only the first 100 result sets are
displayed in the grid.
Is there any way to change this limit so I can get all results?
Regards
SteenWhich version are you using ? On SQL 2005 Ent. RTM version I don't have
this problem. I can select 1000000 rows and all are displayed in the
grid.
Markus|||Rows is not the same as resultsets. Steen has the problem that the query returns > 100 result sets.
AFAIK, this is not a configurable limit.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"MarkusB" <m.bohse@.quest-consultants.com> wrote in message
news:1132222959.738766.69660@.g47g2000cwa.googlegroups.com...
> Which version are you using ? On SQL 2005 Ent. RTM version I don't have
> this problem. I can select 1000000 rows and all are displayed in the
> grid.
> Markus
>|||Tibor Karaszi wrote:
> Rows is not the same as resultsets. Steen has the problem that the query returns > 100 result sets.
> AFAIK, this is not a configurable limit.
>
Thanks Tibor. It's not a major problem - it's just annoying when it
happens..;-). I've also looked around to see if I could find somewhere
where it could be configured but with no luck.
Regards
Steen

Grid results in Management Studio

Hi
When I run a query in Management Studio, I get this message -
The query has exceeded the maximum number of result sets that can be
displayed in the results grid. Only the first 100 result sets are
displayed in the grid.
Is there any way to change this limit so I can get all results?
Regards
Steen
Which version are you using ? On SQL 2005 Ent. RTM version I don't have
this problem. I can select 1000000 rows and all are displayed in the
grid.
Markus
|||Rows is not the same as resultsets. Steen has the problem that the query returns > 100 result sets.
AFAIK, this is not a configurable limit.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"MarkusB" <m.bohse@.quest-consultants.com> wrote in message
news:1132222959.738766.69660@.g47g2000cwa.googlegro ups.com...
> Which version are you using ? On SQL 2005 Ent. RTM version I don't have
> this problem. I can select 1000000 rows and all are displayed in the
> grid.
> Markus
>
|||Tibor Karaszi wrote:
> Rows is not the same as resultsets. Steen has the problem that the query returns > 100 result sets.
> AFAIK, this is not a configurable limit.
>
Thanks Tibor. It's not a major problem - it's just annoying when it
happens..;-). I've also looked around to see if I could find somewhere
where it could be configured but with no luck.
Regards
Steen

Grid results in Management Studio

Hi
When I run a query in Management Studio, I get this message -
The query has exceeded the maximum number of result sets that can be
displayed in the results grid. Only the first 100 result sets are
displayed in the grid.
Is there any way to change this limit so I can get all results?
Regards
SteenWhich version are you using ? On SQL 2005 Ent. RTM version I don't have
this problem. I can select 1000000 rows and all are displayed in the
grid.
Markus|||Rows is not the same as resultsets. Steen has the problem that the query ret
urns > 100 result sets.
AFAIK, this is not a configurable limit.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"MarkusB" <m.bohse@.quest-consultants.com> wrote in message
news:1132222959.738766.69660@.g47g2000cwa.googlegroups.com...
> Which version are you using ? On SQL 2005 Ent. RTM version I don't have
> this problem. I can select 1000000 rows and all are displayed in the
> grid.
> Markus
>|||Tibor Karaszi wrote:
> Rows is not the same as resultsets. Steen has the problem that the query r
eturns > 100 result sets.
> AFAIK, this is not a configurable limit.
>
Thanks Tibor. It's not a major problem - it's just annoying when it
happens..;-). I've also looked around to see if I could find somewhere
where it could be configured but with no luck.
Regards
Steen