May 9, 2011 at 11:04 am
mikeincape (5/9/2011)
Yes... This gives me the dataset I need. Thanks!... Still getting that weird error though... Any Ideas?
Ninja's is going to kick me for repeating what he already proved wrong...but i still say it's compatibility;
can you double check it?
Lowell
May 9, 2011 at 11:05 am
alan.williams (5/9/2011)
Why not just do a Union of the two queries
Delete that line
WHERE RW = 1
May 9, 2011 at 11:06 am
Are you using any 3rd party application that refactors sql?
Using SQL management Studio to execute the queries you are sening me... No 3rd party apps anywhere.
Also, we've done it by date but you're doing it by id in the original code. My gut tells me that the date is actually the correct sorting, then maybe flagid as tie breaker.
FlagID or Date DESC... Both would produce the same result... The last flag to match that code.
May 9, 2011 at 11:07 am
Lowell (5/9/2011)
mikeincape (5/9/2011)
Yes... This gives me the dataset I need. Thanks!... Still getting that weird error though... Any Ideas?Ninja's is going to kick me for repeating what he already proved wrong...but i still say it's compatibility;
can you double check it?
I'd never do that. Ok maybe but still, that's uncalled for :hehe:.
It's definitely possible, but if he could run my create db code, then I don't see why it would fail there (never seen that before).
The only thing I can think off is to put model at level 80 and try my code again. Maybe there's a weird difference in sys tables that makes this fail.
May 9, 2011 at 11:09 am
mikeincape (5/9/2011)
Are you using any 3rd party application that refactors sql?
Using SQL management Studio to execute the queries you are sening me... No 3rd party apps anywhere.
Also, we've done it by date but you're doing it by id in the original code. My gut tells me that the date is actually the correct sorting, then maybe flagid as tie breaker.
FlagID or Date DESC... Both would produce the same result... The last flag to match that code.
I'm just saying, I'v seen tones of apps that allow to work in a different workday. So on the 1st of the month you can still enter documents for the 31st of the last month. In that case sorting by date, then flag id is the correct way to do it. Not just flagid.
May 9, 2011 at 11:09 am
Ninja's_RGR'us (5/9/2011)
It's definitely possible, but if he could run my create db code, then I don't see why it would fail there (never seen that before).
The only thing I can think off is to put model at level 80 and try my code again. Maybe there's a weird difference in sys tables that makes this fail.
could it be his 2005 client tools are returning an error but still executing the code, where our 2008 tools either never raise the error or suppress it?
Lowell
May 9, 2011 at 11:10 am
Lowell (5/9/2011)
Ninja's_RGR'us (5/9/2011)
It's definitely possible, but if he could run my create db code, then I don't see why it would fail there (never seen that before).
The only thing I can think off is to put model at level 80 and try my code again. Maybe there's a weird difference in sys tables that makes this fail.
could it be his 2005 client tools are returning an error but still executing the code, where our 2008 tools either never raise the error or suppress it?
I'm on 2005 both for tools and engine.
What bugs me is that the code gets refactored. SSMS will NOT do that on it's own. Something must be installed to do that.
May 9, 2011 at 11:11 am
Lowell (5/9/2011)
mikeincape (5/9/2011)
Yes... This gives me the dataset I need. Thanks!... Still getting that weird error though... Any Ideas?Ninja's is going to kick me for repeating what he already proved wrong...but i still say it's compatibility;
can you double check it?
I am definitely in 90 mode...

May 9, 2011 at 11:14 am
Ninja's_RGR'us (5/9/2011)
Lowell (5/9/2011)
Ninja's_RGR'us (5/9/2011)
It's definitely possible, but if he could run my create db code, then I don't see why it would fail there (never seen that before).
The only thing I can think off is to put model at level 80 and try my code again. Maybe there's a weird difference in sys tables that makes this fail.
could it be his 2005 client tools are returning an error but still executing the code, where our 2008 tools either never raise the error or suppress it?
I'm on 2005 both for tools and engine.
What bugs me is that the code gets refactored. SSMS will NOT do that on it's own. Something must be installed to do that.
It's always bothered me that it does that... But its done it on all 3 of the servers I have installed it on, and my copy of management express I am using on my local PC here. What I have been doing today is from management express on my local pc. Think I should login to my server and use the full version of sql management studio?
Local software:
Microsoft SQL Server Management Studio Express9.00.2047.00
Microsoft Data Access Components (MDAC)6.1.7601.17514 (win7sp1_rtm.101119-1850)
Microsoft MSXML3.0 4.0 5.0 6.0
Microsoft Internet Explorer8.0.7601.17514
Microsoft .NET Framework2.0.50727.5444
Operating System6.1.7601
May 9, 2011 at 11:15 am
We're missing something really simple. Like running on wrong server, wrong DB, stupid syntaxe issue. Maybe a trigger somewhere?!?!?
Are you running something else in that batch?
I'm going to say it again. The code won't magically reformat itself. You have a 3rd party application doing that for you.
May 9, 2011 at 11:17 am
mikeincape (5/9/2011)
Ninja's_RGR'us (5/9/2011)
Lowell (5/9/2011)
Ninja's_RGR'us (5/9/2011)
It's definitely possible, but if he could run my create db code, then I don't see why it would fail there (never seen that before).
The only thing I can think off is to put model at level 80 and try my code again. Maybe there's a weird difference in sys tables that makes this fail.
could it be his 2005 client tools are returning an error but still executing the code, where our 2008 tools either never raise the error or suppress it?
I'm on 2005 both for tools and engine.
What bugs me is that the code gets refactored. SSMS will NOT do that on it's own. Something must be installed to do that.
It's always bothered me that it does that... But its done it on all 3 of the servers I have installed it on, and my copy of management express I am using on my local PC here. What I have been doing today is from management express on my local pc. Think I should login to my server and use the full version of sql management studio?
Local software:
Microsoft SQL Server Management Studio Express9.00.2047.00
Microsoft Data Access Components (MDAC)6.1.7601.17514 (win7sp1_rtm.101119-1850)
Microsoft MSXML3.0 4.0 5.0 6.0
Microsoft Internet Explorer8.0.7601.17514
Microsoft .NET Framework2.0.50727.5444
Operating System6.1.7601
Yes please.
Also what does that return?
SELECT @@version
May 9, 2011 at 11:20 am
Ahhh Ha!
Ok.... Runs fine on my server. Must be from using the express version on my local pc...
Microsoft SQL Server Management Studio9.00.4035.00
Microsoft Analysis Services Client Tools2005.090.4035.00
Microsoft Data Access Components (MDAC)2000.086.3959.00 (srv03_sp2_rtm.070216-1710)
Microsoft MSXML2.6 3.0 4.0 6.0
Microsoft Internet Explorer8.0.6001.18702
Microsoft .NET Framework2.0.50727.3620
Operating System5.2.3790
Thanks for all the help!
Now if we want to get real complicated I have one more query that needs to happen in the loop... Think we can pile more onto this query? I will post what I need in a reply.
BTW: The query I am using that seems to work best is:
SELECT
cl.RecordStatus,
cl.ActiveClient,
cl.SystemEffective,
cl.Firstname,
cl.Lastname,
cl.MiddleI,
cl.SSN,
cl.ClientID,
cl.City,
cl.State,
cl.Zip,
cl.HomePhone,
cl.Address1,
bg.FlagDate as EnteredDate,
fl.FlagDate as MoneyReceived
FROM Clients cl
LEFT OUTER JOIN
(SELECT
ClientID,
FlagDate
FROM Flags
WHERE (FlagCode=1001)
) bg
ON cl.ClientID = bg.ClientID
LEFT OUTER JOIN
(SELECT
ClientID,
FlagDate
FROM (SELECT
ROW_NUMBER() OVER (PARTITION BY ClientID ORDER BY ClientID,FlagCode desc,FlagDate DESC) AS RW,
ClientID,
FlagDate
FROM Flags
WHERE (FlagCode=3001 OR FlagCode=3002)
)myAlias
WHERE RW = 1
) fl
ON cl.ClientID = fl.ClientID
WHERE cl.AgentID=20
ORDER BY
cl.Lastname,
cl.Firstname,
cl.MiddleI
May 9, 2011 at 11:23 am
mikeincape (5/9/2011)
Ahhh Ha!Ok.... Runs fine on my server. Must be from using the express version on my local pc...
[fist pump] YES!!!!
Lowell
May 9, 2011 at 11:27 am
Lowell (5/9/2011)
mikeincape (5/9/2011)
Ahhh Ha!Ok.... Runs fine on my server. Must be from using the express version on my local pc...
[fist pump] YES!!!!
BOTH hands on the keyboard plz! :smooooth:
May 9, 2011 at 11:27 am
mikeincape (5/9/2011)
Ahhh Ha!Ok.... Runs fine on my server. Must be from using the express version on my local pc...
Microsoft SQL Server Management Studio9.00.4035.00
Microsoft Analysis Services Client Tools2005.090.4035.00
Microsoft Data Access Components (MDAC)2000.086.3959.00 (srv03_sp2_rtm.070216-1710)
Microsoft MSXML2.6 3.0 4.0 6.0
Microsoft Internet Explorer8.0.6001.18702
Microsoft .NET Framework2.0.50727.3620
Operating System5.2.3790
Thanks for all the help!
Now if we want to get real complicated I have one more query that needs to happen in the loop... Think we can pile more onto this query? I will post what I need in a reply.
BTW: The query I am using that seems to work best is:
SELECTcl.RecordStatus,
cl.ActiveClient,
cl.SystemEffective,
cl.Firstname,
cl.Lastname,
cl.MiddleI,
cl.SSN,
cl.ClientID,
cl.City,
cl.State,
cl.Zip,
cl.HomePhone,
cl.Address1,
bg.FlagDate as EnteredDate,
fl.FlagDate as MoneyReceived
FROM Clients cl
LEFT OUTER JOIN
(SELECT
ClientID,
FlagDate
FROM Flags
WHERE (FlagCode=1001)
) bg
ON cl.ClientID = bg.ClientID
LEFT OUTER JOIN
(SELECT
ClientID,
FlagDate
FROM (SELECT
ROW_NUMBER() OVER (PARTITION BY ClientID ORDER BY ClientID,FlagCode desc,FlagDate DESC) AS RW,
ClientID,
FlagDate
FROM Flags
WHERE (FlagCode=3001 OR FlagCode=3002)
)myAlias
WHERE RW = 1
) fl
ON cl.ClientID = fl.ClientID
WHERE cl.AgentID=20
ORDER BY
cl.Lastname,
cl.Firstname,
cl.MiddleI
Sure, what else do you need?
Viewing 15 posts - 31 through 45 (of 58 total)
You must be logged in to reply to this topic. Login to reply