Viewing 15 posts - 12,991 through 13,005 (of 14,953 total)
Simon Facer (7/2/2008)
GSquared (7/2/2008)
Don't use table variables unless you absolutely have to. Even then, check your options with someone else.
Why do you say that? I'm not necessarily an advocate...
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 3, 2008 at 7:59 am
Steve Jones - Editor (7/2/2008)
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 3, 2008 at 7:50 am
Congrats. Well deserved. 🙂
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 3, 2008 at 7:18 am
John Rowan (7/2/2008)
I think Jeff is reffering to ALTER TABLE SWITCH ... for partitioned tables
Yes, this is what I thought also, but the OP had not mentioned using SQL...
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 2:52 pm
Odd. I don't get that in mine. The plan just gets rid of the other two columns, but is otherwise identical.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 2:49 pm
Jeff Moden (7/2/2008)
I'm with Gus, but let me go one step further. With 5000 procedures (I assume that's like saying "a bazillion"), and all those ugly WHERE clauses, etc,...
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 2:45 pm
I have to admit, these days, I generally use the GUI to build maintenance plans and schedule them. Easier than writing my own cursors and all that.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 2:37 pm
declare DatabasesCur cursor local fast_forward
for
select name
from sys.databases
... set up the cursor, open it, assign the name to a variable
While @@Fetch_Status = 0
Begin
select @sql = 'Use ' + @DBName...
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 2:36 pm
I'm talking about something like this:
eclare @CurrentDt smalldatetime
declare @CurrentDtStr varchar(8)
set @CurrentDt = getdate()
set @CurrentDtStr = CONVERT(VARCHAR,@CurrentDt,112)
WHILE NOT EXISTS
(SELECT *
FROM DB2_PROD_DCDB.DCDB.APP.NIAD_ETL_STATUS
WHERE CONVERT(VARCHAR,etl_dt,112) = @CurrentDtStr)
AND datepart(hour, getdate()) < 23
BEGIN
WAITFOR DELAY...
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 2:33 pm
Generally, for that kind of thing, I use a cursor to step through the databases and run a dynamic SQL command on each one. It's the only place I...
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 2:26 pm
Inserting it into a staging table means you don't have to mess around with making the clustered index match the order in the import file. You can use a...
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 2:22 pm
You have a proc/script in your trace that doesn't select/update/insert/delete anything in any tables.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 2:18 pm
I think that's just a display issue in the plan. I get the same thing with both versions of your query.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 2:16 pm
You have my sympathy. As expected, a procedural programmer with no clue how relational databases work.
It can be done as a series of joins, which will be faster, but...
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 1:22 pm
Good that it works.
I was only looking for table definition data if the query didn't work.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
July 2, 2008 at 1:19 pm
Viewing 15 posts - 12,991 through 13,005 (of 14,953 total)