Viewing 15 posts - 14,416 through 14,430 (of 14,953 total)
Jeff Moden (4/1/2008)
GSquared (4/1/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
April 1, 2008 at 4:09 pm
And for a little more housecleaning, I'd replace:
CREATE Table #CertType (
Type VARCHAR(50),
XID INT
)
INSERT iNTO #CertType
SELECT DISTINCT Type, XID...
- 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
April 1, 2008 at 3:44 pm
Replace:
and 1 =
case
when @CertType is null then 1
else
case
...
- 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
April 1, 2008 at 3:42 pm
Since you've already hard-coded all of this part:
Create TABLE #CertStatus (
StatusID INT,
StatusDesc CHAR(20)
)
INSERT INTO...
- 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
April 1, 2008 at 3:36 pm
Change:
ProcessDate BETWEEN @yesterday AND @today
to:
ProcessDate >=@yesterday AND processdate < @today
Otherwise, you'll run the risk of getting data from midnight last night (technically today) in the mix.
- 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
April 1, 2008 at 3:28 pm
That one's Left Outer (as previously noted).
!= is not equal.
- 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
April 1, 2008 at 3:25 pm
Okay. Now I can follow what's going on.
You have a trigger that uses a cursor to call a proc that uses a cursor to call another proc that calls...
- 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
April 1, 2008 at 3:06 pm
Thinking about another post on this same thread, there is another solution, which would be to have every proc that needs the hierarchy create a temp table around a specific...
- 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
April 1, 2008 at 2:53 pm
TheSQLGuru (4/1/2008)
1) most code doesn't actually GET reused because a) all devs don't know about it, b) devs don't bother checking to see if their...
- 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
April 1, 2008 at 2:36 pm
TheSQLGuru (3/31/2008)
GSquared (3/31/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
April 1, 2008 at 11:57 am
Andre, I must be missing something. Your updateSettings proc doesn't seem to actually do anything except call itself recursively. I don't see any update/insert/delete commands in it. ...
- 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
April 1, 2008 at 11:44 am
You're welcome.
Without the temp table, you'd quickly run into the problem of too many selects, which Management Studio will bomb out on.
Of course, it's a really bad idea to run...
- 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
April 1, 2008 at 11:24 am
select dateadd(month, 1, cast(enddate + '01' as datetime)) - 1
from dbo.sasimp
Should give you what you need. If it gives you an error about converting enddate to varchar, try this:
select...
- 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
April 1, 2008 at 11:15 am
I modified the script as follows:
create table #Test (
DB varchar(100),
TableName varchar(100),
RowQty int)
DECLARE @dbname VARCHAR(50)
DECLARE @string VARCHAR(2500)
DECLARE db_cursor CURSOR
FOR SELECT name
...
- 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
April 1, 2008 at 9:15 am
I'm going to hazard a guess that [Date] and/or [DateImport] are datetime columns with the date AND the time in them. In which case, your Group By is almost...
- 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
April 1, 2008 at 8:46 am
Viewing 15 posts - 14,416 through 14,430 (of 14,953 total)