michael
2/23/2008 3:31:00 PM
OK. I'm on to something here. However, I'm sure that the StoredProcedure
that is being executed has only one SELECT being run. And, in addition, the
"other" table that is experiencing the unexpected "Modified" is completely
different than the table which is actually being filled. Rows from the first
table wouldn't "fit" into the second table. So, I'm still puzzled.
I included the StoredProcedure that gets fired. It's not really all that
complicated and each return identical columns. And, only one ResultSet should
be returned with each execution.
IF @PNumber=-1
BEGIN
SELECT P.[Current Location], P.Bed, P.[Full Name], P.[Medical Record
Number], P.[Billing Number], COUNT(S1.[Service Record Number]) AS [Count of
Services]
FROM Patients AS P LEFT OUTER JOIN
Service AS S1 ON P.[Medical Record Number] = S1.[Medical Record
Number] AND P.[Billing Number] = S1.[Billing Number]
GROUP BY P.[Current Location], P.Bed, P.[Full Name], P.[Medical Record
Number], P.[Billing Number]
HAVING (P.[Current Location] LIKE @Unit)
ORDER BY P.[Current Location], P.[Full Name]
END
ELSE
BEGIN
SELECT P.[Current Location], P.Bed, P.[Full Name], P.[Medical Record
Number], P.[Billing Number], COUNT(S1.[Service Record Number]) AS [Count of
Services]
FROM Patients AS P LEFT OUTER JOIN
Service AS S1 ON P.[Medical Record Number] = S1.[Medical Record
Number] AND P.[Billing Number] = S1.[Billing Number]
WHERE S1.[Service Provider]=@ProviderNumber
GROUP BY P.[Current Location], P.Bed, P.[Full Name], P.[Medical Record
Number], P.[Billing Number]
HAVING (P.[Current Location] LIKE @Unit)
ORDER BY P.[Current Location], P.[Full Name]
END
END
--
Michael
"William Vaughn" wrote:
> Precisely. Any SQL Server query can contain more than one SELECT as can
> stored procedures.
>
> --
> __________________________________________________________________________
> William R. Vaughn
> President and Founder Beta V Corporation
> Author, Mentor, Dad, Grandpa
> Microsoft MVP
> (425) 556-9205 (Pacific time)
> Hitchhiker???s Guide to Visual Studio and SQL Server (7th Edition)
> ____________________________________________________________________________________________
> "michael" <michael@discussions.microsoft.com> wrote in message
> news:2389A015-A57D-416E-9AD5-DBA77B8BDCE7@microsoft.com...
> > Could you please indulge me and expand on your answer? When you say more
> > than
> > one resultset, do you mean that there's more than one Select being
> > executed
> > and those rows are placed in a different table?
> > --
> > Michael
> >
> >
> > "William Vaughn" wrote:
> >
> >> The Fill method handles multiple resultsets. If more than one rowset is
> >> returned, it posts the rows (the changes) to more than one DataTable.
> >>
> >> --
> >> __________________________________________________________________________
> >> William R. Vaughn
> >> President and Founder Beta V Corporation
> >> Author, Mentor, Dad, Grandpa
> >> Microsoft MVP
> >> (425) 556-9205 (Pacific time)
> >> Hitchhiker???s Guide to Visual Studio and SQL Server (7th Edition)
> >> ____________________________________________________________________________________________
> >> "michael" <michael@discussions.microsoft.com> wrote in message
> >> news:DDA0C497-29D7-4808-93CC-F00EC8AF98CF@microsoft.com...
> >> >I have 2 separate DataTables in a DataSet. These tables are in no way
> >> >related
> >> > to one anohter with Relations.
> >> >
> >> > When I Fill one table, it causes a row's RowState in the other table to
> >> > change from Unchanged to Modified. In the absence of editing the row!
> >> > Can
> >> > anyone think of ways to figure out what might be causing this?
> >> >
> >> >
> >> > --
> >> > Michael
> >>
>