Viewing 15 posts - 2,716 through 2,730 (of 2,894 total)
try:
INSERT INTO DestinationTable(UserId,DriveCode,Intrested,DriveId)
SELECT p.userid,p.DriveCode,p.0,p.DriveID
FROM @paramtertable p
LEFT JOIN DestinationTable d
ON d.UserId = p.UserId
AND d.DriveCode = p.DriveCode
WHERE d.UserId IS NULL
June 22, 2010 at 4:58 am
GilaMonster (6/21/2010)
There's no OR here. If you want to retrieve the data in a particular order, there must be an order by on that select. The presence of a clustered...
June 22, 2010 at 4:29 am
As RAISERROR WITH LOG will write into EventLog it will negatively affect performance of the existing code for sure.
BUT!
The real question is: Will the negative effect of its use...
June 22, 2010 at 3:05 am
...
I spoke to a couple of the people after the session. They'd either been told by colleagues or had encountered blocking in their queries, went looking for a way to...
June 21, 2010 at 3:05 am
GilaMonster (6/19/2010)
I asked in a TechEd presentation last year how many people used nolock often (session on query hints and plan guides). About 1/4 of the room put up their...
June 20, 2010 at 2:02 pm
Jeff, in a final code I would use temp table (like in the first sample). But in this case I did it with CTE to save few lines of code...
June 19, 2010 at 10:40 am
I am not sure what you mean by dynamic sql in your case.
Dynamic sql is the way to execute sql from a given string. Achieved by using EXECUTE(@SQL) function or...
June 19, 2010 at 4:00 am
Jeff Moden (6/18/2010)
Eugene Elutin (6/18/2010)
...
Nicely done but I believe you're dropping the first hour. Also, be careful of the 23:59:59.000 thing. A lot of data can happen in...
June 19, 2010 at 3:46 am
Lynn Pettis (6/19/2010)
Eugene Elutin (6/18/2010)
I can be wrong,...
June 19, 2010 at 2:35 am
Ok, I assume that if the person used it, he knows what "WITH (NOLOCK) does, therefore it must be acceptable in their case.
I can be wrong, of cause.
June 18, 2010 at 2:04 pm
Nice problem.
Here is my first attempt:
declare @periodStart datetime
declare @periodEnd datetime
-- they must be inside of the same day!!!!
set @periodStart = '20100601'
set @periodEnd = '2010-06-10 23:59:59.000'
declare @givendate datetime
set @givendate =...
June 18, 2010 at 2:01 pm
I am assuming this query is run for reporting purposes, therefore dirty reads might be acceptable.
June 18, 2010 at 1:20 pm
Without table DDL and data sample setup it is hard to test
, but try:
select
count(distinct pmi.Id) as TotalPrograms
,count(pt.Id) ...
June 18, 2010 at 11:00 am
try:
select id
from mytable
group by id
having min(val) != max(val)
June 18, 2010 at 9:56 am
duanecwilson (6/18/2010)
...What am I missing here?
...
It's simple! You are missing the setup of tables and sample data population scripts to represent your question/case in a helpfull way, which would...
June 18, 2010 at 9:32 am
Viewing 15 posts - 2,716 through 2,730 (of 2,894 total)