Click here to Skip to main content
11,642,613 members (65,839 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-Server trigger
CREATE TRIGGER MyTrigger ON TableA
AFTER INSERT
 
AS
 
DECLARE @COLUMN1 AS NVARCHAR
DECLARE @COLUMN2 AS NVARCHAR
DECLARE @COLUMN3 AS NVARCHAR
 
SELECT @COLUMN1=COLUMN1,@COLUMN2=COLUMN2 FROM INSERTED
EXEC STOREDPROCEDURE @COLUMN1,@COLUMN2,@COLUMN3=?
i have two tables named table A and Table B and for the insertion purpose i have two stored procedure for both table. and when Table A's stored procedure will executes successfully a trigger will fire to call Table B's Stored procedure But My Question is How to pass parameter to Table B's stored procedure? as in my case table A does not contain column3 but in Table B i need To insert data in Column3
Posted 27-Jun-12 1:32am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Make @COLUMN3 parameter in Table B storedprocedure as optional parameter.
  Permalink  
Comments
jitz102002 at 27-Jun-12 8:21am
   
its not optional passed value for @column3 from Table A' stored procedure but i m looking forward to get dat value from Table A stored procedure return value so i can pass it to table b stored procedure by trigger

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

  Print Answers RSS
0 DamithSL 254
1 Sergey Alexandrovich Kryukov 204
2 OriginalGriff 160
3 Afzaal Ahmad Zeeshan 129
4 Mika Wendelius 85
0 Mika Wendelius 485
1 DamithSL 457
2 OriginalGriff 365
3 Afzaal Ahmad Zeeshan 258
4 Sergey Alexandrovich Kryukov 254


Advertise | Privacy | Mobile
Web03 | 2.8.150731.1 | Last Updated 27 Jun 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