June 1, 2015 at 11:41 am
dunn_Stephen (6/1/2015)
Actually should have looked more like this.Insert INTO dbo.QABSNew(
[logTime],
[fromServer],
[toServer],
[service],
[messageId],
[filePath])
SELECT T.logTime, T.filePath, T.fromServer, T.toServer, T.service, T.messageId
FROM QABSNew T
LEFT JOIN temp_LogImporter E on T.logTime = E.logTime
WHERE ISNULL (E.logTime, '') = ''
This looks a litle bit more sensible than the first version you posted. But it still doesn't make much sense.
Are you trying to duplicate records in QABSNew if they are there before the query runs and their logTime is not matched in temp_LogImporter? That is one effect the query will have.
Are you trying to not duplicate records in QABSNew if their logTime is matched in in temp_LogImorter and it isn't ''? That is the other thing that the query will do.
Are you trying to get any records from temp_LogImporter whose logTime isn't matched into QABSNew? That is something the query won't do.
I think you should carefully set down what you ware trying to achieve, and then start with a query to achieve part of it, and when that works add to the query so that it achieves some more of it, and so on until you have all of it. Or describe what you are trying to achieve here and maybe we can help you achieve it.
Tom
Viewing post 16 (of 15 total)
You must be logged in to reply to this topic. Login to reply