Viewing 15 posts - 3,826 through 3,840 (of 3,957 total)
EKF is 100% correct - this should be a single update with no loop.
Try rewriting it that way to see if your execution time problem goes away.
If you're not sure...
April 3, 2012 at 6:49 pm
Phil,
Actually I need to thank you as well. As it turns out, I happen to be developing a course on SQL at this moment and this particular problem illustrates...
April 3, 2012 at 6:27 pm
I posted a solution on a similar topic quite recently here:
http://www.sqlservercentral.com/Forums/Topic1273926-392-2.aspx
Perhaps this will help you, perhaps not. Depends on your incoming data format and exactly how you need your...
April 3, 2012 at 3:30 am
Think about it, you are explicitly using an order by. This is how the dynamic tally table works.
Yes I know. But then why does removing the INNER JOIN cause...
April 3, 2012 at 3:05 am
Thanks for posting some reasonably consumable DDL!
Try this:
--Essential Project Columns
DECLARE @Projects TABLE(
[Project] [VARCHAR](255) NULL,
[Owner] [VARCHAR](36) NULL,
[Sponsor] [VARCHAR](36) NULL,
[StartDate] [DATETIME] NULL,
[DueDate] [DATETIME] NULL,
[Resources] [VARCHAR](255) NULL
)
--Generic Data (Multiple Resources delimited with...
April 2, 2012 at 7:21 pm
Lynn,
To ensure order you need an ORDER BY clause.
How about this case?
DECLARE @n TABLE (n INT)
INSERT @n (n)
SELECT 5
UNION ALL SELECT 1
UNION ALL SELECT 4
UNION ALL SELECT 2
UNION ALL SELECT...
April 2, 2012 at 6:40 pm
-- Also works
if @minage > @maxage set @minage = @maxage + @minage
if @minage > @maxage set @maxage = @minage - @maxage
if @minage > @maxage set @minage = @minage -...
April 2, 2012 at 8:25 am
-- Won't work
if @minage > @maxage set @minage = @maxage
if @minage > @maxage set @maxage = @minage
-- Will work
if @minage > @maxage select @minage = @maxage, @maxage = @minage
April 2, 2012 at 7:35 am
Mr. Cadavre,
You may want to try these two against each other. I think the CROSS APPLY is faster:
SET STATISTICS TIME ON
SET STATISTICS IO ON
IF OBJECT_ID('TempDB..#Temp') IS NOT NULL
DROP TABLE...
April 2, 2012 at 7:26 am
Mine is not to question why, only to do it without CURSORs:
DECLARE @u TABLE (type VARCHAR(25), VARCHAR(10), email VARCHAR(100))
INSERT INTO @u (type, , email)
SELECT 'Administrator','a','a@abc.com'
UNION ALL SELECT 'Administrator','b','b@abc.com'
UNION ALL...
April 2, 2012 at 6:46 am
Either of the following will return the results you want. The second is the way I would do it and it has a much better execution plan cost.
;with calendar...
April 2, 2012 at 6:35 am
I am not sure why Cadavre's solution returns this record, because I don't think there's record in Data for Customer C and ProjA:
ProjA CustomerC...
April 2, 2012 at 2:22 am
Is something like this what you mean to do (try it in a Test database :-))?
delete g
FROM gwinn_hw g
LEFT OUTER JOIN (
select ptid, pat_ext_id, pat_last_name, pat_first_name, gwn_practice_id, kis_practice_id
, Max(d_vital) as...
April 2, 2012 at 1:04 am
I had to fix some of the column names in your CREATE TABLE to match the columns referenced on the INSERTs and this may not do it the way you...
April 1, 2012 at 11:34 pm
I am not sure this will solve your problem because if @userid is NULL it can only mean you're not getting a match when you query it out of your...
April 1, 2012 at 11:08 pm
Viewing 15 posts - 3,826 through 3,840 (of 3,957 total)