Viewing 15 posts - 9,766 through 9,780 (of 14,953 total)
I don't see anything in the requirements about rows in Table1 that don't have a match in Table2, so I left it as an outer join. Maybe I just...
April 28, 2009 at 12:16 pm
How are the original values stored? Is it a text file? A spreadsheet? Something else?
April 28, 2009 at 12:12 pm
There's a whole lot of data on this site about getting started. Poke around a bit, you'll find plenty of articles and discussions on the subject.
A lot of it's...
April 28, 2009 at 12:11 pm
Is this in the old "pubs" database? Sure sounds like it.
April 28, 2009 at 12:09 pm
Would need to see the execution plan to know where to really start.
At a guess, I think this index might help, but I can't be sure without test data and...
April 28, 2009 at 11:21 am
First, why are you using cursors for this?
Second, I see a whole bunch of columns in the Where clauses that aren't mentioned in your description.
April 28, 2009 at 11:05 am
Will something like this do what you need:
;with T2 as
(select row_number() over (partition by Table1Key order by EventDate desc) as Row,
Table1Key,
EventDate,
EventText
from dbo.Table2)
select *
from dbo.Table1
left outer join T2
on Table1.ID =...
April 28, 2009 at 11:02 am
If you want to convert a string like that to a time, then I recommend this method:
declare @Time int;
select @Time = 123757;
select dateadd(second, @Time%100, dateadd(minute, @Time%10000/100, dateadd(hour, @Time/10000, 0)))
Just ran...
April 28, 2009 at 9:26 am
slange (4/27/2009)
I must be missing something...would it not work if you just removed the loop and inserted the records?
There are times when it's more efficient to do batches like this....
April 28, 2009 at 9:04 am
Bob Hovious (4/25/2009)
1. Create temporary table "A"
2. Populate it with base ids
3. Query table "B" and update one...
April 28, 2009 at 8:34 am
There are advantages and disadvantages to each.
First, neither one is a "natural key", so they're the same on that point.
Second, GUIDs take more disk space, RAM and bandwidth than Int...
April 27, 2009 at 8:14 am
To deal with times that don't have enough leading zeroes, you can either padd the string, or you can reverse it. Either one works.
April 27, 2009 at 7:28 am
The main advantage to leaving it as XML is that it's less work, both for you and for the server. It has a secondary advantage in that minor schema...
April 27, 2009 at 7:09 am
Actually, in SQL 2005, another solution that sometimes works is to use an Output clause to insert into a temp table, then use that to manage the loop. That...
April 27, 2009 at 7:06 am
Another good one.
And on whatever the medical situation is, get well soon, man.
April 27, 2009 at 6:57 am
Viewing 15 posts - 9,766 through 9,780 (of 14,953 total)