Click here to Skip to main content
16,004,944 members
Home / Discussions / Database
   

Database

 
AnswerRe: Checking for an Existing record when Updating Pin
kumarprabhakar7412-Jul-06 0:21
kumarprabhakar7412-Jul-06 0:21 
QuestionUpdate statement Pin
angelagke11-Jul-06 18:23
angelagke11-Jul-06 18:23 
AnswerRe: Update statement Pin
Dinuj Nath11-Jul-06 20:51
Dinuj Nath11-Jul-06 20:51 
GeneralRe: Update statement Pin
angelagke11-Jul-06 21:37
angelagke11-Jul-06 21:37 
GeneralRe: Update statement Pin
VK-Cadec12-Jul-06 10:01
VK-Cadec12-Jul-06 10:01 
GeneralRe: Update statement Pin
angelagke13-Jul-06 2:07
angelagke13-Jul-06 2:07 
QuestionConnectionString works for VB6/VBNET/VBNET2003 for SQL SERVER but not for VBNET2005 SQL SERVER only local Pin
Serpiente11-Jul-06 15:16
Serpiente11-Jul-06 15:16 
QuestionOutput parameter in stored procedure Pin
leckey11-Jul-06 9:27
leckey11-Jul-06 9:27 
I've been researching this but am confused on how to set up the syntax.
I have a stored procedure that bascially does the following:
1. Recieves two parameters: a part type, and a part number. The part number is actually a varchar.
2. Inserts the part type ID (taken from a second table called PartTypes) and Part Number into the table Parts.
3. The table Parts has a third field, ID which is an auto-incrmemented number. (Apparently the "Part Number" can change so we use this auto-incremented ID to reference the part number in other tables to keep things simple if the number changes.)

Okay, what I need to do is once that gets inserted into the Parts table, I need to use that Parts.ID that the system assigned. I need to send it back to the page that called it.

So two questions:
1. how do I set up this OUTPUT thing? The code I found online wasn't very helpful. Here is the stored proc:
CREATE PROCEDURE [dbo].[UpdatePart_Step_1]<br />
@PartNumber varchar (15),<br />
@PartTypeDescription varchar (60) <br />
<br />
AS<br />
declare @pt_id integer<br />
<br />
if NOT EXISTS (Select * from Parts where PartNumber = @PartNumber)<br />
BEGIN<br />
<br />
SELECT  @pt_id = pt.ID FROM PartTypes pt <br />
<br />
INNER JOIN Parts p on pt.ID = p.PartTypeID<br />
<br />
WHERE pt.Description = @PartTypeDescription<br />
<br />
insert into Parts<br />
(PartNumber, PartTypeID)<br />
<br />
VALUES<br />
(<br />
@PartNumber,<br />
@pt_id<br />
)<br />
END<br />
return 0<br />
GO


2. How do I get this value back into the original page that called the stored proc?

My thinking is that I should create a completely separate stored proc to get this Parts.ID, but I'm not sure what the norm is.

Thanks again all!
AnswerRe: Output parameter in stored procedure Pin
nguyenvhn11-Jul-06 22:38
nguyenvhn11-Jul-06 22:38 
GeneralRe: Output parameter in stored procedure Pin
leckey12-Jul-06 3:13
leckey12-Jul-06 3:13 
QuestionDB Connection Failure using C# Pin
Cadence2.011-Jul-06 9:03
Cadence2.011-Jul-06 9:03 
AnswerRe: DB Connection Failure using C# Pin
god_bless_the_world11-Jul-06 11:22
god_bless_the_world11-Jul-06 11:22 
GeneralRe: DB Connection Failure using C# Pin
Cadence2.011-Jul-06 11:47
Cadence2.011-Jul-06 11:47 
QuestionStored Procedures Pin
HRiazi11-Jul-06 6:50
HRiazi11-Jul-06 6:50 
AnswerThe best third party tool Pin
Ennis Ray Lynch, Jr.12-Jul-06 7:15
Ennis Ray Lynch, Jr.12-Jul-06 7:15 
QuestionSQL Server files very large Pin
dptalt11-Jul-06 5:17
dptalt11-Jul-06 5:17 
AnswerRe: SQL Server files very large Pin
Eric Dahlvang11-Jul-06 7:48
Eric Dahlvang11-Jul-06 7:48 
GeneralRe: SQL Server files very large Pin
dptalt13-Jul-06 3:09
dptalt13-Jul-06 3:09 
GeneralRe: SQL Server files very large Pin
Eric Dahlvang13-Jul-06 3:52
Eric Dahlvang13-Jul-06 3:52 
QuestionSQL String to insert values into a table that are C# variables. Pin
DavidSAtWork11-Jul-06 4:51
DavidSAtWork11-Jul-06 4:51 
AnswerRe: SQL String to insert values into a table that are C# variables. Pin
albCode11-Jul-06 5:00
albCode11-Jul-06 5:00 
GeneralRe: SQL String to insert values into a table that are C# variables. Pin
Colin Angus Mackay11-Jul-06 5:05
Colin Angus Mackay11-Jul-06 5:05 
GeneralRe: SQL String to insert values into a table that are C# variables. Pin
albCode11-Jul-06 5:12
albCode11-Jul-06 5:12 
AnswerRe: SQL String to insert values into a table that are C# variables. Pin
Colin Angus Mackay11-Jul-06 5:08
Colin Angus Mackay11-Jul-06 5:08 
GeneralRe: SQL String to insert values into a table that are C# variables. Pin
User 171649211-Jul-06 5:38
professionalUser 171649211-Jul-06 5:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.