Viewing 15 posts - 54,031 through 54,045 (of 59,068 total)
Problem with such calcs is that you have to recalculate them over and over. Recommend you take a look at Joe Celko's post on the "Nested Set Model" instead...
November 20, 2007 at 9:21 pm
I believe you've hit the nail on the head... not sure even a "by value" would help on such a recursive call...
November 20, 2007 at 9:05 pm
I understand what you're trying to do... but I don't understand why. I realize you've made some simplified test data and I appreciate that. There are several answers...
November 20, 2007 at 8:50 pm
I agree with Matt... with the data given, there is no way to relate the correct Discharge to any given Admit... SID certainly won't do it. You need a...
November 20, 2007 at 8:46 pm
select a.* from customera a
join customerb b on (a.company+a.zipcode<>b.company+b.zipcode)
Ummmm... You might wanna go back and take a look at that code...
[font="Courier New"]--===== Setup a test table and populate with test data
 CREATE TABLE CustomersA (Company VARCHAR(5), ZipCode CHAR(5))
 INSERT INTO CustomersA 
        (Company,ZipCode)
 SELECT 'AAA', '11111' UNION ALL
 SELECT 'BBB', '22222' UNION ALL
 SELECT 'CCC', '33333' UNION ALL
 SELECT 'DDD', '44444' UNION ALL
 SELECT 'EEE', '55555'
--===== Setup identical test table and populate with identical data
     -- except for one row
 CREATE TABLE CustomersB (Company VARCHAR(5), ZipCode CHAR(5))
 INSERT INTO CustomersB
        (Company,ZipCode)
 SELECT Company,ZipCode
   FROM TableA
  WHERE Company <> 'CCC'
--===== PostIt's code
select a.* from customersa a
join customersb b on (a.company+a.zipcode<>b.company+b.zipcode)[/font]
Try this, instead...
[font="Courier New"]SELECT a.*
   FROM CustomersA a
   LEFT OUTER JOIN CustomersB b
     ON a.Company = b.Company
    AND a.ZipCode = b.ZipCode
  WHERE b.Company IS NULL[/font]
November 20, 2007 at 8:36 pm
... and lock down the production database... Developers should not have SA privs in the production database and they should not be promoting their own code. Look what happens...
November 20, 2007 at 8:08 pm
Maybe we need to buy in a CRM system?
Yep... then run it on two Cray's... one for the interface, one for the Data Warehouse 😛 Maybe get an...
November 20, 2007 at 8:05 pm
Heh... yeah, coffee works for me, too. Don't feel bad... I tried the code and had to think about why it wasn't working 😛
Easiest way to do this is...
November 20, 2007 at 7:39 am
Rude or unprofessional? Hell, you started it... first you wouldn't answer my simple question even though I gave you an answer that works... good forum etiquette dictates that you...
November 20, 2007 at 6:07 am
And, yet, my simple question goes unanswered. I just want to know why whoever you're writing this for thinks they need it in such a dumb format. Don't...
November 19, 2007 at 7:17 pm
Even with that, it's still gonna blow up... the skipped rows have to have the same format as those that aren't. It's a fault in both Bulk Insert and...
November 19, 2007 at 5:12 pm
Matt Miller (11/19/2007)
Jeff Moden (11/19/2007)
Server: Msg 8102, Level 16, State 1, Line 4
Cannot update identity...
November 19, 2007 at 5:09 pm
Cool... glad to see someone else using a Tally table...
November 19, 2007 at 5:04 pm
If you just TRUNCATE the tables, no reseeding is necessary... IDENTITY columns will start over.
November 19, 2007 at 4:59 pm
Viewing 15 posts - 54,031 through 54,045 (of 59,068 total)