Thursday, March 29, 2012

Can't get more than first field to evaluate.

I am having trouble getting an

IMBogus1 -

Can you provide more details about your problem? I'm afraid you haven't given us enough information to even know what you were doing when you had problems.

thanks,

|||We are still waiting on information from you. If we don’t hear from you in the next seven days, we will delete the thread. We do this to keep the system full of useful information for customers searching for answers and focus expert attention on active unanswered questions.|||

The trouble I am having is doing an evaluation expression of multiple results and looking for the entire sum of the results in my evaluation expression. Instead it only returns the sum or count of the first result field and ignores all the other result fields.

Thanks,

Pete

|||

Pete -

I can't tell from your description whether you are having this issue with a feature of Team Edition for Database Professionals, or whether you're having some sort of general Visual Studio problem. Can you provide a little more background? What Visual Studio feature are you using when you encountering this problem? Is this something you are running in to while using the Database Unit Testing features?

|||i am working on sql reporting|||

Ah, okay. I've moved your thread to the SQL Server Reporting Services forum, where you can get a better response about SQL Server Reporting questions.

Can't get mirroring working for all DBs?

I'm getting the following errors when trying to set up mirroring for a DB.
[PRINCIPAL]
Date3/2/2007 2:52:06 PM
LogSQL Server (Current - 3/5/2007 8:44:00 AM)
Sourcespid99
Message
Communications to the remote server instance 'TCP://SQL2:5022' failed before
database mirroring was fully started. The ALTER DATABASE command failed.
Retry the command when the remote database is started.
Date3/2/2007 2:52:06 PM
LogSQL Server (Current - 3/5/2007 8:44:00 AM)
Sourcespid99
Message
Error: 1413, Severity: 16, State: 1.
Date3/2/2007 2:52:06 PM
LogSQL Server (Current - 3/5/2007 8:44:00 AM)
Sourcespid37s
Message
The mirroring connection to "TCP://SQL2:5022" has timed out for database
"DB1" after 10 seconds without a response. Check the service and network
connections.
Date3/2/2007 2:52:06 PM
LogSQL Server (Current - 3/5/2007 8:44:00 AM)
Sourcespid37s
Message
Error: 1479, Severity: 16, State: 1.
[MIRROR]
Date3/2/2007 2:52:49 PM
LogSQL Server (Current - 3/5/2007 8:46:00 AM)
Sourcespid35s
Message
The mirroring connection to "TCP://SQL1:5022" has timed out for database
"DB1" after 5 seconds without a response. Check the service and network
connections.
Date3/2/2007 2:52:49 PM
LogSQL Server (Current - 3/5/2007 8:46:00 AM)
Sourcespid35s
Message
Error: 1479, Severity: 16, State: 1.
This only occurs for this particular DB. I have mirroring running
successfully for 4 other DBs. The only difference I can see is that the
problematic DB is significantly larger than the other mirrored DBs... it's
~70GB.
I'm running SQL 2005 Enterprise x64 for both principal and mirror SQL
instances.
Please help...
interesting. cant say I've seen this before but trying running consistancy
check DBCC CHECKDB (refer to BOL) perhaps a corruption in the db is causing
the timeout.
M.
"slin" <slin@.discussions.microsoft.com> wrote in message
news:E52523C6-0B5C-4507-B6FA-9439EFD1C02E@.microsoft.com...
> I'm getting the following errors when trying to set up mirroring for a DB.
> [PRINCIPAL]
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid99
> Message
> Communications to the remote server instance 'TCP://SQL2:5022' failed
> before
> database mirroring was fully started. The ALTER DATABASE command failed.
> Retry the command when the remote database is started.
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid99
> Message
> Error: 1413, Severity: 16, State: 1.
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid37s
> Message
> The mirroring connection to "TCP://SQL2:5022" has timed out for database
> "DB1" after 10 seconds without a response. Check the service and network
> connections.
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid37s
> Message
> Error: 1479, Severity: 16, State: 1.
>
> [MIRROR]
> Date 3/2/2007 2:52:49 PM
> Log SQL Server (Current - 3/5/2007 8:46:00 AM)
> Source spid35s
> Message
> The mirroring connection to "TCP://SQL1:5022" has timed out for database
> "DB1" after 5 seconds without a response. Check the service and network
> connections.
>
> Date 3/2/2007 2:52:49 PM
> Log SQL Server (Current - 3/5/2007 8:46:00 AM)
> Source spid35s
> Message
> Error: 1479, Severity: 16, State: 1.
>
> This only occurs for this particular DB. I have mirroring running
> successfully for 4 other DBs. The only difference I can see is that the
> problematic DB is significantly larger than the other mirrored DBs... it's
> ~70GB.
> I'm running SQL 2005 Enterprise x64 for both principal and mirror SQL
> instances.
> Please help...
|||Already did a DBCC CHECKDB... No errors. I'm using Profiler to see if it'll
show me what's failing, but not having any luck so far...
-S
"Mark Broadbent" wrote:

> interesting. cant say I've seen this before but trying running consistancy
> check DBCC CHECKDB (refer to BOL) perhaps a corruption in the db is causing
> the timeout.
> M.
>
> "slin" <slin@.discussions.microsoft.com> wrote in message
> news:E52523C6-0B5C-4507-B6FA-9439EFD1C02E@.microsoft.com...
>
>
|||Well... I finally got it working. It seemed like the large physical size of
the transaction log file was causing the problem. The log file was 200GB,
but it was only 1% used. I shrunk the log file size back down to 1GB and did
the whole restore/backup process and mirroring started right up.
"slin" wrote:
[vbcol=seagreen]
> Already did a DBCC CHECKDB... No errors. I'm using Profiler to see if it'll
> show me what's failing, but not having any luck so far...
> -S
> "Mark Broadbent" wrote:
sql

Can't get mirroring working for all DBs?

I'm getting the following errors when trying to set up mirroring for a DB.
[PRINCIPAL]
Date 3/2/2007 2:52:06 PM
Log SQL Server (Current - 3/5/2007 8:44:00 AM)
Source spid99
Message
Communications to the remote server instance 'TCP://SQL2:5022' failed before
database mirroring was fully started. The ALTER DATABASE command failed.
Retry the command when the remote database is started.
Date 3/2/2007 2:52:06 PM
Log SQL Server (Current - 3/5/2007 8:44:00 AM)
Source spid99
Message
Error: 1413, Severity: 16, State: 1.
Date 3/2/2007 2:52:06 PM
Log SQL Server (Current - 3/5/2007 8:44:00 AM)
Source spid37s
Message
The mirroring connection to "TCP://SQL2:5022" has timed out for database
"DB1" after 10 seconds without a response. Check the service and network
connections.
Date 3/2/2007 2:52:06 PM
Log SQL Server (Current - 3/5/2007 8:44:00 AM)
Source spid37s
Message
Error: 1479, Severity: 16, State: 1.
[MIRROR]
Date 3/2/2007 2:52:49 PM
Log SQL Server (Current - 3/5/2007 8:46:00 AM)
Source spid35s
Message
The mirroring connection to "TCP://SQL1:5022" has timed out for database
"DB1" after 5 seconds without a response. Check the service and network
connections.
Date 3/2/2007 2:52:49 PM
Log SQL Server (Current - 3/5/2007 8:46:00 AM)
Source spid35s
Message
Error: 1479, Severity: 16, State: 1.
This only occurs for this particular DB. I have mirroring running
successfully for 4 other DBs. The only difference I can see is that the
problematic DB is significantly larger than the other mirrored DBs... it's
~70GB.
I'm running SQL 2005 Enterprise x64 for both principal and mirror SQL
instances.
Please help...interesting. cant say I've seen this before but trying running consistancy
check DBCC CHECKDB (refer to BOL) perhaps a corruption in the db is causing
the timeout.
M.
"slin" <slin@.discussions.microsoft.com> wrote in message
news:E52523C6-0B5C-4507-B6FA-9439EFD1C02E@.microsoft.com...
> I'm getting the following errors when trying to set up mirroring for a DB.
> [PRINCIPAL]
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid99
> Message
> Communications to the remote server instance 'TCP://SQL2:5022' failed
> before
> database mirroring was fully started. The ALTER DATABASE command failed.
> Retry the command when the remote database is started.
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid99
> Message
> Error: 1413, Severity: 16, State: 1.
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid37s
> Message
> The mirroring connection to "TCP://SQL2:5022" has timed out for database
> "DB1" after 10 seconds without a response. Check the service and network
> connections.
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid37s
> Message
> Error: 1479, Severity: 16, State: 1.
>
> [MIRROR]
> Date 3/2/2007 2:52:49 PM
> Log SQL Server (Current - 3/5/2007 8:46:00 AM)
> Source spid35s
> Message
> The mirroring connection to "TCP://SQL1:5022" has timed out for database
> "DB1" after 5 seconds without a response. Check the service and network
> connections.
>
> Date 3/2/2007 2:52:49 PM
> Log SQL Server (Current - 3/5/2007 8:46:00 AM)
> Source spid35s
> Message
> Error: 1479, Severity: 16, State: 1.
>
> This only occurs for this particular DB. I have mirroring running
> successfully for 4 other DBs. The only difference I can see is that the
> problematic DB is significantly larger than the other mirrored DBs... it's
> ~70GB.
> I'm running SQL 2005 Enterprise x64 for both principal and mirror SQL
> instances.
> Please help...|||Already did a DBCC CHECKDB... No errors. I'm using Profiler to see if it'll
show me what's failing, but not having any luck so far...
-S
"Mark Broadbent" wrote:

> interesting. cant say I've seen this before but trying running consistancy
> check DBCC CHECKDB (refer to BOL) perhaps a corruption in the db is causin
g
> the timeout.
> M.
>
> "slin" <slin@.discussions.microsoft.com> wrote in message
> news:E52523C6-0B5C-4507-B6FA-9439EFD1C02E@.microsoft.com...
>
>|||Well... I finally got it working. It seemed like the large physical size of
the transaction log file was causing the problem. The log file was 200GB,
but it was only 1% used. I shrunk the log file size back down to 1GB and di
d
the whole restore/backup process and mirroring started right up.
"slin" wrote:
[vbcol=seagreen]
> Already did a DBCC CHECKDB... No errors. I'm using Profiler to see if it'
ll
> show me what's failing, but not having any luck so far...
> -S
> "Mark Broadbent" wrote:
>

Can't get mirroring working for all DBs?

I'm getting the following errors when trying to set up mirroring for a DB.
[PRINCIPAL]
Date 3/2/2007 2:52:06 PM
Log SQL Server (Current - 3/5/2007 8:44:00 AM)
Source spid99
Message
Communications to the remote server instance 'TCP://SQL2:5022' failed before
database mirroring was fully started. The ALTER DATABASE command failed.
Retry the command when the remote database is started.
Date 3/2/2007 2:52:06 PM
Log SQL Server (Current - 3/5/2007 8:44:00 AM)
Source spid99
Message
Error: 1413, Severity: 16, State: 1.
Date 3/2/2007 2:52:06 PM
Log SQL Server (Current - 3/5/2007 8:44:00 AM)
Source spid37s
Message
The mirroring connection to "TCP://SQL2:5022" has timed out for database
"DB1" after 10 seconds without a response. Check the service and network
connections.
Date 3/2/2007 2:52:06 PM
Log SQL Server (Current - 3/5/2007 8:44:00 AM)
Source spid37s
Message
Error: 1479, Severity: 16, State: 1.
[MIRROR]
Date 3/2/2007 2:52:49 PM
Log SQL Server (Current - 3/5/2007 8:46:00 AM)
Source spid35s
Message
The mirroring connection to "TCP://SQL1:5022" has timed out for database
"DB1" after 5 seconds without a response. Check the service and network
connections.
Date 3/2/2007 2:52:49 PM
Log SQL Server (Current - 3/5/2007 8:46:00 AM)
Source spid35s
Message
Error: 1479, Severity: 16, State: 1.
This only occurs for this particular DB. I have mirroring running
successfully for 4 other DBs. The only difference I can see is that the
problematic DB is significantly larger than the other mirrored DBs... it's
~70GB.
I'm running SQL 2005 Enterprise x64 for both principal and mirror SQL
instances.
Please help...interesting. cant say I've seen this before but trying running consistancy
check DBCC CHECKDB (refer to BOL) perhaps a corruption in the db is causing
the timeout.
M.
"slin" <slin@.discussions.microsoft.com> wrote in message
news:E52523C6-0B5C-4507-B6FA-9439EFD1C02E@.microsoft.com...
> I'm getting the following errors when trying to set up mirroring for a DB.
> [PRINCIPAL]
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid99
> Message
> Communications to the remote server instance 'TCP://SQL2:5022' failed
> before
> database mirroring was fully started. The ALTER DATABASE command failed.
> Retry the command when the remote database is started.
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid99
> Message
> Error: 1413, Severity: 16, State: 1.
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid37s
> Message
> The mirroring connection to "TCP://SQL2:5022" has timed out for database
> "DB1" after 10 seconds without a response. Check the service and network
> connections.
> Date 3/2/2007 2:52:06 PM
> Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> Source spid37s
> Message
> Error: 1479, Severity: 16, State: 1.
>
> [MIRROR]
> Date 3/2/2007 2:52:49 PM
> Log SQL Server (Current - 3/5/2007 8:46:00 AM)
> Source spid35s
> Message
> The mirroring connection to "TCP://SQL1:5022" has timed out for database
> "DB1" after 5 seconds without a response. Check the service and network
> connections.
>
> Date 3/2/2007 2:52:49 PM
> Log SQL Server (Current - 3/5/2007 8:46:00 AM)
> Source spid35s
> Message
> Error: 1479, Severity: 16, State: 1.
>
> This only occurs for this particular DB. I have mirroring running
> successfully for 4 other DBs. The only difference I can see is that the
> problematic DB is significantly larger than the other mirrored DBs... it's
> ~70GB.
> I'm running SQL 2005 Enterprise x64 for both principal and mirror SQL
> instances.
> Please help...|||Already did a DBCC CHECKDB... No errors. I'm using Profiler to see if it'll
show me what's failing, but not having any luck so far...
-S
"Mark Broadbent" wrote:
> interesting. cant say I've seen this before but trying running consistancy
> check DBCC CHECKDB (refer to BOL) perhaps a corruption in the db is causing
> the timeout.
> M.
>
> "slin" <slin@.discussions.microsoft.com> wrote in message
> news:E52523C6-0B5C-4507-B6FA-9439EFD1C02E@.microsoft.com...
> > I'm getting the following errors when trying to set up mirroring for a DB.
> >
> > [PRINCIPAL]
> >
> > Date 3/2/2007 2:52:06 PM
> > Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> > Source spid99
> > Message
> > Communications to the remote server instance 'TCP://SQL2:5022' failed
> > before
> > database mirroring was fully started. The ALTER DATABASE command failed.
> > Retry the command when the remote database is started.
> >
> > Date 3/2/2007 2:52:06 PM
> > Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> > Source spid99
> > Message
> > Error: 1413, Severity: 16, State: 1.
> >
> > Date 3/2/2007 2:52:06 PM
> > Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> > Source spid37s
> > Message
> > The mirroring connection to "TCP://SQL2:5022" has timed out for database
> > "DB1" after 10 seconds without a response. Check the service and network
> > connections.
> >
> > Date 3/2/2007 2:52:06 PM
> > Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> > Source spid37s
> > Message
> > Error: 1479, Severity: 16, State: 1.
> >
> >
> > [MIRROR]
> >
> > Date 3/2/2007 2:52:49 PM
> > Log SQL Server (Current - 3/5/2007 8:46:00 AM)
> > Source spid35s
> > Message
> > The mirroring connection to "TCP://SQL1:5022" has timed out for database
> > "DB1" after 5 seconds without a response. Check the service and network
> > connections.
> >
> >
> > Date 3/2/2007 2:52:49 PM
> > Log SQL Server (Current - 3/5/2007 8:46:00 AM)
> > Source spid35s
> > Message
> > Error: 1479, Severity: 16, State: 1.
> >
> >
> > This only occurs for this particular DB. I have mirroring running
> > successfully for 4 other DBs. The only difference I can see is that the
> > problematic DB is significantly larger than the other mirrored DBs... it's
> > ~70GB.
> >
> > I'm running SQL 2005 Enterprise x64 for both principal and mirror SQL
> > instances.
> >
> > Please help...
>
>|||Well... I finally got it working. It seemed like the large physical size of
the transaction log file was causing the problem. The log file was 200GB,
but it was only 1% used. I shrunk the log file size back down to 1GB and did
the whole restore/backup process and mirroring started right up.
"slin" wrote:
> Already did a DBCC CHECKDB... No errors. I'm using Profiler to see if it'll
> show me what's failing, but not having any luck so far...
> -S
> "Mark Broadbent" wrote:
> > interesting. cant say I've seen this before but trying running consistancy
> > check DBCC CHECKDB (refer to BOL) perhaps a corruption in the db is causing
> > the timeout.
> >
> > M.
> >
> >
> > "slin" <slin@.discussions.microsoft.com> wrote in message
> > news:E52523C6-0B5C-4507-B6FA-9439EFD1C02E@.microsoft.com...
> > > I'm getting the following errors when trying to set up mirroring for a DB.
> > >
> > > [PRINCIPAL]
> > >
> > > Date 3/2/2007 2:52:06 PM
> > > Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> > > Source spid99
> > > Message
> > > Communications to the remote server instance 'TCP://SQL2:5022' failed
> > > before
> > > database mirroring was fully started. The ALTER DATABASE command failed.
> > > Retry the command when the remote database is started.
> > >
> > > Date 3/2/2007 2:52:06 PM
> > > Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> > > Source spid99
> > > Message
> > > Error: 1413, Severity: 16, State: 1.
> > >
> > > Date 3/2/2007 2:52:06 PM
> > > Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> > > Source spid37s
> > > Message
> > > The mirroring connection to "TCP://SQL2:5022" has timed out for database
> > > "DB1" after 10 seconds without a response. Check the service and network
> > > connections.
> > >
> > > Date 3/2/2007 2:52:06 PM
> > > Log SQL Server (Current - 3/5/2007 8:44:00 AM)
> > > Source spid37s
> > > Message
> > > Error: 1479, Severity: 16, State: 1.
> > >
> > >
> > > [MIRROR]
> > >
> > > Date 3/2/2007 2:52:49 PM
> > > Log SQL Server (Current - 3/5/2007 8:46:00 AM)
> > > Source spid35s
> > > Message
> > > The mirroring connection to "TCP://SQL1:5022" has timed out for database
> > > "DB1" after 5 seconds without a response. Check the service and network
> > > connections.
> > >
> > >
> > > Date 3/2/2007 2:52:49 PM
> > > Log SQL Server (Current - 3/5/2007 8:46:00 AM)
> > > Source spid35s
> > > Message
> > > Error: 1479, Severity: 16, State: 1.
> > >
> > >
> > > This only occurs for this particular DB. I have mirroring running
> > > successfully for 4 other DBs. The only difference I can see is that the
> > > problematic DB is significantly larger than the other mirrored DBs... it's
> > > ~70GB.
> > >
> > > I'm running SQL 2005 Enterprise x64 for both principal and mirror SQL
> > > instances.
> > >
> > > Please help...
> >
> >
> >

Tuesday, March 27, 2012

Can't get MAX DISTINCT to work the way I want it to

I have 3 numeric fields in a table that need to be returned by a query:
SupervisorLineID (autoincrementing ordinal), SupervisorID and LineID.
SupervisorLineID is the only definite unique value; there are cases where
one supervisor can manage more than one production line, and thus be
represented many times in the table. There are also cases where more than
one supervisor can manage a line, complicating things further.
What I need to return is one unique record for each LineID, with the highest
SupervisorLineID number as the selecting factor, along with the matching
SupervisorID. I tried using MAX DISTINCT on the SupervisorLineID, but oddly
enough it caused the opposite of what I expected: all supervisors were
returned EXCEPT the one represented by the max SupervisorLineID per line!
This caused lines to appear more than once in many cases.
I've tried various approaches and none produce the desired results. I know
this has to be possible-- any ideas?
Thanks,
Randall ArnoldRandall Arnold wrote:

> I've tried various approaches and none produce the desired results.
> I know this has to be possible-- any ideas?
Please provide DDL and some testdata, you are talking about more than 1
table I presume? We can't guess all the tablestructures.
Kind regards,
Stijn Verrept|||Hi
Since you have not posted a table stucture + sample data I did some testing
on Northwind database and Orders table
SELECT * FROM Orders
WHERE OrderDate=(SELECT MAX(OrderDate) from Orders O
WHERE O.CustomerId=Orders.CustomerId)
Getting highest OrderDate for each Customer
"Randall Arnold" <randall.arnold@.nokia.com> wrote in message
news:OwClf.16116$Nb2.285732@.news1.nokia.com...
>I have 3 numeric fields in a table that need to be returned by a query:
>SupervisorLineID (autoincrementing ordinal), SupervisorID and LineID.
>SupervisorLineID is the only definite unique value; there are cases where
>one supervisor can manage more than one production line, and thus be
>represented many times in the table. There are also cases where more than
>one supervisor can manage a line, complicating things further.
> What I need to return is one unique record for each LineID, with the
> highest SupervisorLineID number as the selecting factor, along with the
> matching SupervisorID. I tried using MAX DISTINCT on the
> SupervisorLineID, but oddly enough it caused the opposite of what I
> expected: all supervisors were returned EXCEPT the one represented by the
> max SupervisorLineID per line! This caused lines to appear more than once
> in many cases.
> I've tried various approaches and none produce the desired results. I
> know this has to be possible-- any ideas?
> Thanks,
> Randall Arnold
>|||Randall wrote on Wed, 07 Dec 2005 14:41:50 GMT:

> I have 3 numeric fields in a table that need to be returned by a query:
> SupervisorLineID (autoincrementing ordinal), SupervisorID and LineID.
> SupervisorLineID is the only definite unique value; there are cases where
> one supervisor can manage more than one production line, and thus be
> represented many times in the table. There are also cases where more than
> one supervisor can manage a line, complicating things further.
> What I need to return is one unique record for each LineID, with the
> highest SupervisorLineID number as the selecting factor, along with the
> matching SupervisorID. I tried using MAX DISTINCT on the
> SupervisorLineID, but oddly enough it caused the opposite of what I expect
ed:
> all supervisors were returned EXCEPT the one represented by the max
> SupervisorLineID per line! This caused lines to appear more than once in
> many cases.
> I've tried various approaches and none produce the desired results. I
> know this has to be possible-- any ideas?
> Thanks,
> Randall Arnold
DISTINCT applies to an entire row, not a single column.
Without DDL I've had to make some assumptions.
I think this might work ...
SELECT A.LineID, A.SLID, B.SupervisorID FROM
(SELECT LineID, MAX(SupervisorLineID) AS SLID FROM Table GROUP BY LineID) AS
A)
INNER JOIN Table B ON A.SLID = B.SupervisorLineID AND A.LineID = B.LineID
There's probably an easier way to write this.
Dan|||Actually it's only one table, and I provided the structure (field list) in t
he first post. That's really all there is to the table. Sorry if I didn't
make that clear, but I would have listed other tables if any were involved.
Test data would be as follows:
RecentLineSupervisor_View SupervisorID SupervisorLineID LineID
18 9804 1
108 9913 1
128 -->9964 1
7 9715 19
11 9752 19
118 -->9894 19
1 9831 20
24 9688 20
108 -->9927 20
6 9782 22
77 9771 22
78 -->9978 22
As I said, I just want to see each LineID represented once, with the highest
value for SupervisorLineID determining which record is returned. Desired re
cords marked with arrows.
Thanks,
Randall Arnold
"Stijn Verrept" <stjin@.entrysoft.com> wrote in message news:YLWdnelcNs6FZAveRVnyig@.scarlet.
biz...
> Randall Arnold wrote:
>
>
> Please provide DDL and some testdata, you are talking about more than 1
> table I presume? We can't guess all the tablestructures.
>
> --
>
> Kind regards,
>
> Stijn Verrept|||Randall Arnold wrote:
> I have 3 numeric fields in a table that need to be returned by a query:
> SupervisorLineID (autoincrementing ordinal), SupervisorID and LineID.
> SupervisorLineID is the only definite unique value; there are cases where
> one supervisor can manage more than one production line, and thus be
> represented many times in the table. There are also cases where more than
> one supervisor can manage a line, complicating things further.
>
If those are the only three columns then the combination of
(supervisorid, lineid) should be unique and declared as such -
otherwise your table is full of redundant garbage. Therefore the answer
would be:
SELECT supervisorid, lineid
FROM your_table AS T
WHERE supervisorlineid =
(SELECT MAX(supervisorlineid)
FROM your_table
WHERE lineid = T.lineid) ;
However, you then seem to be breaking the golden rule of using an
IDENTITY column - don't assign any business significance to it. In
future, please post DDL and sample data so that we don't have to guess
your requirements.
David Portas
SQL Server MVP
--|||Please don't assume I designed this table; rest assured I would NOT have
taken this approach! I'm stuck with trying to extract meaningful
information from a previous employee's cowboy database. In fact, the only
reason I have to create this query at all is to select a single
supervisor-to-line record for each line, and that ability *should* have been
designed into the structure. Had the former data manager done his job
properly, I wouldn't be dealing with this.
As for DDL and structure, it seemed to me I posted enough info. As I told
another gentleman, had there been another table involved I would have
indicated so. I also figured that listing the only 3 fields involved and
describing their type and role would cover it; note that everyone who
provided a suggestion based on a single table was on the right track so it
seems to me it wasn't TOO confusing. But I'll try to be more pedantic in
the future <g>.
Anyway, it looks like one of the methods listed here will work. Thanks all,
Randall Arnold
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1133968276.805046.224980@.o13g2000cwo.googlegroups.com...
> Randall Arnold wrote:
> If those are the only three columns then the combination of
> (supervisorid, lineid) should be unique and declared as such -
> otherwise your table is full of redundant garbage. Therefore the answer
> would be:
> SELECT supervisorid, lineid
> FROM your_table AS T
> WHERE supervisorlineid =
> (SELECT MAX(supervisorlineid)
> FROM your_table
> WHERE lineid = T.lineid) ;
> However, you then seem to be breaking the golden rule of using an
> IDENTITY column - don't assign any business significance to it. In
> future, please post DDL and sample data so that we don't have to guess
> your requirements.
> --
> David Portas
> SQL Server MVP
> --
>|||Randall Arnold wrote:
> Please don't assume I designed this table; rest assured I would NOT have
> taken this approach! I'm stuck with trying to extract meaningful
> information from a previous employee's cowboy database. In fact, the only
> reason I have to create this query at all is to select a single
> supervisor-to-line record for each line, and that ability *should* have be
en
> designed into the structure. Had the former data manager done his job
> properly, I wouldn't be dealing with this.
> As for DDL and structure, it seemed to me I posted enough info. As I told
> another gentleman, had there been another table involved I would have
> indicated so. I also figured that listing the only 3 fields involved and
> describing their type and role would cover it; note that everyone who
> provided a suggestion based on a single table was on the right track so it
> seems to me it wasn't TOO confusing. But I'll try to be more pedantic in
> the future <g>.
> Anyway, it looks like one of the methods listed here will work. Thanks al
l,
> Randall Arnold
>
In the absence of the DDL it's reasonable to assume that we lack the
information about the alternate key(s) because that information was so
conspicuously absent from your post. I didn't assume you designed it. I
assumed you'd want to fix it.
David Portas
SQL Server MVP
--|||> As for DDL and structure, it seemed to me I posted enough info.
That's all fine and good. However, in order for us to provide you with a
meaningful, accurate and testable solution, instead of guessing, we ask for
a bit more. I don't understand where the vehement objection to providing
proper specs comes from. The prevailing opinion seems to be that we are
lazy and are trying to be a pain in the ass. Nothing could be further from
the truth... please read http://www.aspfaq.com/5006 before assuming that
what you provide should be enough for anyone to solve the problem.|||There was no "vehement objection" to providing proper specs, Aaron. Just a
minor goof IMO on my part based on personal tendencies (ie, omitting
reference to what *isn't* there such as other tables). I don't understand
where this perception of a "vehement objection" comes from. Certainaly not
from anything I've posted! Personally, I'm all too eager to provide as much
detail as possible. Again, I *thought* I had. Mea culpa. But no need for
a hangin', please. The verbal beating has been enough.
This is a silly axle anyway. I gotta unwrap myself and get back to work
<g>.
Randall Arnold
"Aaron Bertrand [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:eyRFaW0%23FHA.3676@.tk2msftngp13.phx.gbl...
> That's all fine and good. However, in order for us to provide you with a
> meaningful, accurate and testable solution, instead of guessing, we ask
> for a bit more. I don't understand where the vehement objection to
> providing proper specs comes from. The prevailing opinion seems to be
> that we are lazy and are trying to be a pain in the ass. Nothing could be
> further from the truth... please read http://www.aspfaq.com/5006 before
> assuming that what you provide should be enough for anyone to solve the
> problem.
>

Cant get list of servers

I can't get my server to show with the DMO function ListAvailableSQLServers or with the osql -L flag. The OS is windows 2000, but the drive is fat32 and doesn't have Directory Service.
Do you need NTFS to have Directory Service, and does SQL Server need Directory Service to broadcast its available servers?
I've got Visual Studio .Net and had no luck when I searched for an answer.I meant Active Directory.|||no neither ADS nor NTFS is essential for server listing. r u able to connect to other servers using EM or QA? is EM showing the complete list? of not there could be issues with the broadcasting server. check if 1433 port is not blocked by any firewall programa at server end. also check that the server is not hidden by server network utility >> TCPIP >> hide server.|||It is actually MSDE, so I don't have EM or QA. But I have Visual Studio .Net and it has Server Explorer which functions much like EM and QA. The databases and programs I use to connect are on the same machine. I use this to learn/practice SQL Server. I don't have a machine with a server OS, so I can't check "proper" server operation.
But yes, Server Explorer connects and shows my SS instance. I can use osql, programs I create in VB.net, or even web pages scripted with ADO or DMO objects to connect and modify the SS databases, as long as I specify the server. The only thing I can't seem to do is get a list of the servers (I only have one server).
I have a software firewall, but only have it running while my dial-up is online.
Not sure what you mean by "server network utility >> TCPIP >> hide server". I have the server/client tools that were included (in the tools\binn folder); the program cnfgsvr.exe sounds like a good place to start. I'll check it out.
Thanks|||the server network utility i am referring to uses ...\bin\svrnetcn.exe (non-msde version). the exe u have identified may work as well, not sure. for same machine sql server uses shared-memory net lib. if TCPIP or Named Pipe is not enabled, i have seen that OSQL -L fails to identify local server...|||Yeah, that's the one,SVRNETCN.EXE, the Sql Server Network Utility. Both Tcp/Ip and Named Pipes protocols are enabled, the default port 1433 is set, and the Hide Server option is unchecked.
I forgot to mention that my MSDE was included free with my VS.Net. When I installed it, I chose all the defaults which gave my sql server an instance name of VSDOTNET. I don't know why it didn't just install with the default computername. Maybe that has something to do with it?
So I used the Sql Server Client Network Utility, CLICONFG.EXE, and created aliases, one for tcp/ip and one for named pipes. The aliases were listed properly with OSQL -L and using the DMO App.ListAvailableSQLServers() function. I don't know why computername\vsdotnet won't list without the aliases.

Cant get linq to recognize that sproc has changed

I have a GridView that is populated by a stored procedure via linq. I changed the stored procedure to return an additional column, but I can't get the additional column to show up in the GridView. The GridView has autogeneratecolumns=true, so if I were using a SqlDataSource the new column would show up automagically. But now it is not showing up and I cannot reference it. I can't figure out how to make linq recognize that my stored procedure has changed.

I have tried deleting the sproc definition from the dbml file, making sure the partial class is removed the .vb file, refreshing the stored procedures list in database explorer, and adding the sproc definition back again (a hassle), but still it insists on defining only the original columns and not the new column.

How do get linq to get back in sync with the database?

Is there any way to get linq back in sync after database changes??

sql