Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old August 4th, 2004, 11:22 AM
desireemm desireemm is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 31 desireemm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 38 m 35 sec
Reputation Power: 5
Append stored procedure

I need to make this into an APPEND stored procedure, basically one that inserts data from one table to the other once the record becomes inactive. This is what I have so far I need to the data inserted from another table called the EmployeeGamingLicense (active table). I need for data to get inserted as soon as the Status field shows the record as TERMINATED. Can anyone help pls??


Code:
CREATE PROCEDURE [insert_TERMINATION_TestSp]
 (@TM_#_1  [int],
  @FirstName_2  [nvarchar](50),
  @LastName_3  [nvarchar](50),
  @SocialSecurityNumber_4  [int],
  @DateHired_5  [datetime],
  @Status_6  [nvarchar](50),
  @Title_7  [nvarchar](50),
  @DepartmentName_8  [nvarchar](50))
 
AS INSERT INTO [GamingCommissiondb].[dbo].[TERMINATION] 
  ( [TM #],
  [FirstName],
  [LastName],
  [SocialSecurityNumber],
  [DateHired],
  [Status],
  [Title],
  [DepartmentName]) 
 
VALUES 
 ( @TM_#_1,
  @FirstName_2,
  @LastName_3,
  @SocialSecurityNumber_4,
  @DateHired_5,
  @Status_6,
  @Title_7,
  @DepartmentName_8)
GO

Reply With Quote
  #2  
Old August 14th, 2004, 04:48 PM
Kris_Vanherck's Avatar
Kris_Vanherck Kris_Vanherck is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Belgium, Antwerp
Posts: 177 Kris_Vanherck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 sec
Reputation Power: 5
use a trigger, much more efficiant then a SP and saves you the trouble of having to check the field and call the SP, also allows use of the logical inserted, updated and deleted tables

use an IF UPDATE(fieldname) trigger instead of this

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Append stored procedure


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT