Better Quey Then This
May 18, 2000
Hello,
I am trying to insert records in a table say "TableB"
from "TableA". If a record does not exist in Tableb
then and then insert record from tableA.
as of now my query is
insert tableB
select * from tableA
where id not in(select id from tableB).
I am working with about 200000 records. This query is taking too long. Does any one have a better suggestion.
Thanx for your time.
Hiku
View 1 Replies
Jul 23, 2005
Excuse me for not putting a better name to this but I cannot think of asuitable subject title!anyway, here's what I am trying to doAt work we have a fair amount of data that is to do with people and whatjobs they have completed and at what dateso for exampleJoe Bloggs did design work at 12/12/2004 and spent 5 hours on it.Now, we have a lot of jobs that people haven't put any hours down for atall,and I want to find all those jobs which have had no hours put to them sincethe 30/09/2004I had written a query like soSELECT name, job, dateFROM tableWHERE hours = 0 AND date >='30/09/2004'But this doesn't work as some jobs may come up which have had zero hours onsome particular dates but on some dates that job does have hours on.What I want is to show since 30/09/2004 any jobs which have had no hours atall booked to them consistently.So in effect all the jobs we know longer use and haven't since that date.How would I do that?I know you can probably only give me a vague idea as I have provided notable structure etc.. but I only want a hint really...ThanksJayne
View 2 Replies
View Related
Nov 1, 2007
Hi experts,
what is the scope of # and what is the scope of @
create table #temp(COLUMN01 VARCHAR(500))
DECLARE @TEMP TABLE(COLUMN01 VARCHAR(500))
thanks in advance
Vinod
Even you learn 1%, Learn it with 100% confidence.
View 2 Replies
View Related
Sep 24, 2006
With out any BEGIN Transaction statement , i ran a update query.
I had to update just one record using the "Where field='abc'"
But i happened to miss that. Is there any chance of recovery? can i use the transaction logs to bring back the records before the update?
A quick answer is appreciated.
Sahel
View 1 Replies
View Related