Click here to Skip to main content
15,443,281 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have table1 like dis

Filename, designation, city
Arun. Tl. Hyd
Ajay. Jl. Bang(emp left)

I want output like dis

Fulnam,desgntn,city,currentdt,end date
Arun. Tl. Hyd. 1/2/13. Null
Ajay. Jl. Bang 1/2/15. Currentdt

What I have tried:

I have tried in teradata

Update table2 set enddate=currentdt where full name='ajay'
Posted
Updated 22-Jun-17 4:24am
Comments
[no name] 22-Jun-17 3:41am    
What is Table2 Structure? How u get currentdt?
Vanichow 22-Jun-17 5:54am    
Sorry not current date that is start date

I think it must be:
SQL
Update table2 set [end date]=GetDate() where [Fulnam]='Ajay'
Or to update all names:
SQL
Update table2 set [end date]=GetDate() 
where [Fulnam] IN (SELECT [Filename] FROM table1)
 
Share this answer
 
v3
Comments
Vanichow 22-Jun-17 6:18am    
I want to update 1000 records at a time in single query then how can I write a query for that???
RickZeeland 22-Jun-17 6:38am    
Do you want to use all the names from table1 maybe ?
If you want to all the rows on depend of the full name field then below code could help u to solve the problem

UPDATE TABLE2 SET [END DATE] = GETDATE()
FROM TABLE1 A
INNER JOIN TABLE2 B ON A.FILENAME =  B.FULNAME
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900