No this should not take that long if your database is properly set up and indexed First you need to create those FKs! There is not excuse for not having them to ensure your data integrity. FKs should have their own indexes Inactive date deosn't seem to be in your table structure.Is it a date field?
Make it one if it is not or you are wasting time doing implicit conversions b. InactiveDate is not null and b. InactiveDate '1/1/1900' and b.
InactiveDate '12/31/1899' and b. InactiveDate = @StartDate This whole where clause doesn't make sense. If you are looking for the records that match @startdate then you don't need any of the rest Check out the Execution plan to see where this is taking so long, something is causing a table scan And if there will be large numbers of records in the table varaible, then a temp table tends to perform faster.
You don't say what you are doing with this table in the rest of the proc, are you sure it is the insert statement taking the most time or something else you are doing?
No this should not take that long if your database is properly set up and indexed. First you need to create those FKs! There is not excuse for not having them to ensure your data integrity.
FKs should have their own indexes. Inactive date deosn't seem to be in your table structure. Is it a date field?
Make it one if it is not or you are wasting time doing implicit conversions. B. InactiveDate is not null and b.
InactiveDate '1/1/1900' and b. InactiveDate '12/31/1899' and b. InactiveDate = @StartDate This whole where clause doesn't make sense.
If you are looking for the records that match @startdate then you don't need any of the rest. Check out the Execution plan to see where this is taking so long, something is causing a table scan. And if there will be large numbers of records in the table varaible, then a temp table tends to perform faster.
You don't say what you are doing with this table in the rest of the proc, are you sure it is the insert statement taking the most time or something else you are doing?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.