Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MySQL
create table Test1
(
  WRO varchar(10),
  Test_No varchar(10),
  TestDate datetime
);
 
insert into Test1(WRO,TestDate) values('T0001',now());
create table Test2
(
  WRO varchar(10),
  Test_No varchar(10),
  Test2Date datetime,
  TestAmount varchar(10)
);
i have to update on Test1 Test_No after insert on Test2 table Test_No both have
common field WRO
 
please help me
 

Thanks in Advance...
Posted 8-Oct-12 1:12am
Edited 9-Oct-12 23:47pm
Nelek66.5K
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi haresh,
I can show you an another easy way, U can use scope_identity() which will give you the last inserted value. Declare a variable and maintain the scopeidentity, which you can use in the update statement below of your insert statement.
 
SELECT SCOPE_IDENTITY() AS [SCOPE_IDENTITY]
ThankYou
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

i solved my self...
 
thank you
  Permalink  
Comments
Nelek at 10-Oct-12 4:46am
   
Then why don't you share your solution? It might help other people having the same problem in the future.

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

  Print Answers RSS
0 Dnyaneshwar@Pune 719
1 Sergey Alexandrovich Kryukov 280
2 CPallini 245
3 Peter Leow 240
4 CHill60 235
0 Sergey Alexandrovich Kryukov 9,008
1 OriginalGriff 6,771
2 Peter Leow 4,262
3 Zoltán Zörgő 3,769
4 Richard MacCutchan 2,623


Advertise | Privacy | Mobile
Web04 | 2.8.150128.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100