Click here to Skip to main content
12,243,333 members (53,883 online)
Rate this:
 
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
Nelek93.3K
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 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
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160426.1 | Last Updated 10 Oct 2012
Copyright © CodeProject, 1999-2016
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