Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Question--Inserting New Records

Status
Not open for further replies.

Garridon

Programmer
Mar 2, 2000
718
US
I am really new to SQL Server and am still trying to figure out how to do what is probably really, really basic stuff to meet a deadline.

How do I set up a stored procedure to insert new records into two related tables (the tables are tblCategories and tblIssues, with a one (tblCategories) to many (tblIssues) relationship? Ultimately, I'm just trying to do a simple form in ASP that will update the two tables.

I've done some work in Access, but I'm completely lost here. I think I need learn more about the program before the Microsoft Help would even be helpful! Any assistance would be very appreciated!

Linda Adams
Visit my web site for writing and Microsoft Word tips: Official web site for actor David Hedison:
 
I'm not sure how far you've gotten...but here is some info.

Create a stored procedure in Enterprise Manager
with input values for your table or tables

CREATE PROCEDURE [sp_SomeProcName]

@inputvalue1 integer,
@inputvalue2 varchar(50),
@inputvalue3 varchar(100),
@inputvalue4 integer

AS
insert into Categories(column1,column2) VALUES (@inputvalue1,@inputvalue2)

-- You may need to retrieve the CategoryID you just created
-- to create Issues as children
select @CtgyID = CategoryIDcolumn
from Categories
where???


insert into Issues(Category_ID, column2, column3) VALUES (@CtgyID,@inputvalue3,@inputvalue4)

GO
=================================
Thomas V. Flaherty Jr.
Birch Hill Technology Group, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top