Viewing 15 posts - 14,896 through 14,910 (of 14,953 total)
Based on your original question, the indexes I'd probably use are:
empid (clustered)
deptid (nonclustered)
Then look at a few execution plans for a few of the common queries that use those columns....
- 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
January 4, 2008 at 7:13 am
Some of your questions aren't technical in nature. For example, what to do about data already in the "master table". That depends on what data is 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
January 4, 2008 at 6:59 am
Never mind on the repeating hierarchy. I figured it out. (I think.)
- 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
January 3, 2008 at 11:39 am
Just tested a CTE with 101 levels of hierarchy, and it worked. No error.
- 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
January 3, 2008 at 11:19 am
The place I've had to use iterative code in T-SQL is hierarchies. (I tend to use While instead of cursors, because I can have some set-based operations mixed in...
- 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
January 3, 2008 at 11:05 am
My first guess, based on the data given, is that "400" is a table name (or table alias). In that case, what you need is "[400].[PatientAge]", instead of "[400.PatientAge]"....
- 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
January 3, 2008 at 9:49 am
One way to do it would be an outer join on the existing data vs the incoming data. That would give you rows that have been changed or are...
- 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
January 2, 2008 at 3:07 pm
I'd seriously consider using SSIS for this, if you're using SQL 2005. It can be set up to read various input file formats, variations in column names, 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
January 2, 2008 at 2:54 pm
Yes, it is possible to create a "system" stored procedure, and yes, it's almost always a bad idea.
What problem are you trying to solve by creating one? Most unusual...
- 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
December 31, 2007 at 7:32 am
Yes, you could write this as a single query. It would take a Case statement in the Group By clause. But, I'm with Gail on this one: You're...
- 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
December 31, 2007 at 7:28 am
A trigger can be necessary for checking data validity if the validity is dependent on data in other tables or other rows of the same table, and can't be satisfied...
- 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
December 28, 2007 at 12:38 pm
set nocount on
declare @customers table (
Row int identity primary key,
ID int NOT NULL,
Number [smallint] NULL ,
starting_point [varchar] (5) NULL ,
ending_point [varchar] (5) NULL
)
insert into @customers values (888,1, 'abc', 'def')
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
December 28, 2007 at 11:33 am
Robert, I like your solution of casting dates as integers (I'd cast the datetime as float, but integer works too). Is there any reason not to use an isnull...
- 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
December 28, 2007 at 11:03 am
I'm not sure of a good beginning article on the subject. Basically, it's just a way to express boolean checks on data. Articles on that subject tend to...
- 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
December 28, 2007 at 8:04 am
I tend to use defaults for a couple of reasons.
On a column like "DateCreated", use a default and use "default" in insert statements. Having "default" in there helps document...
- 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
December 28, 2007 at 7:24 am
Viewing 15 posts - 14,896 through 14,910 (of 14,953 total)