Click here to Skip to main content
15,913,685 members
Home / Discussions / Database
   

Database

 
AnswerRe: Using Centralized Database MS SQL Server2000 Pin
Colin Angus Mackay23-Jun-06 1:04
Colin Angus Mackay23-Jun-06 1:04 
Questiondata from database Pin
rcshek22-Jun-06 15:12
rcshek22-Jun-06 15:12 
AnswerRe: data from database Pin
VK-Cadec23-Jun-06 8:25
VK-Cadec23-Jun-06 8:25 
Questionquery Pin
Tara1422-Jun-06 10:57
Tara1422-Jun-06 10:57 
AnswerRe: query Pin
Eric Dahlvang22-Jun-06 11:35
Eric Dahlvang22-Jun-06 11:35 
GeneralRe: query Pin
Tara1422-Jun-06 19:11
Tara1422-Jun-06 19:11 
QuestionStored procedure Pin
Nayota22-Jun-06 8:29
Nayota22-Jun-06 8:29 
AnswerRe: Stored procedure Pin
Dustin Metzgar22-Jun-06 9:23
Dustin Metzgar22-Jun-06 9:23 
I'm not a database expert, but nobody else answered your question so I'll give it a shot. It sounds like you're using Oracle or something because you said auto increment instead of index. But, in SQL Server, you can write an insert statement in your stored procedure like this:

insert into [table] 
(
	column1,
	column2,
	column3
)
values
( 
	@column1,
	@column2,
	@column3,
)
return SCOPE_IDENTITY()

That will return the value in the identity column.

In Oracle, you do it two ways. The first way is to have a sequence and get the next value of the sequence first using:

SELECT table_seq.NEXTVAL AS ID from DUAL

Then when you do your insert, use that ID in your insert.

The other way is to have a sequence and a trigger. Do your insert and then select the max value for that column out of the table and return it. The first way is probably better.

Any of you db gurus out there, please correct me if I'm wrong.




Logifusion[^]
GeneralRe: Stored procedure Pin
Nayota22-Jun-06 10:22
Nayota22-Jun-06 10:22 
GeneralRe: Stored procedure Pin
jonathan1522-Jun-06 23:08
jonathan1522-Jun-06 23:08 
QuestionDataset update Pin
kjosh22-Jun-06 6:10
kjosh22-Jun-06 6:10 
Questionimage Pin
md_refay22-Jun-06 4:26
md_refay22-Jun-06 4:26 
AnswerRe: image Pin
Colin Angus Mackay22-Jun-06 4:51
Colin Angus Mackay22-Jun-06 4:51 
Questionsql server triggers Pin
flippydeflippydebop22-Jun-06 3:59
flippydeflippydebop22-Jun-06 3:59 
AnswerRe: sql server triggers Pin
flippydeflippydebop22-Jun-06 4:19
flippydeflippydebop22-Jun-06 4:19 
GeneralRe: sql server triggers Pin
flippydeflippydebop22-Jun-06 4:26
flippydeflippydebop22-Jun-06 4:26 
GeneralRe: sql server triggers Pin
flippydeflippydebop22-Jun-06 4:44
flippydeflippydebop22-Jun-06 4:44 
GeneralRe: sql server triggers Pin
flippydeflippydebop22-Jun-06 5:06
flippydeflippydebop22-Jun-06 5:06 
Questioninserting 10 rows in a table using a query Pin
248912822-Jun-06 2:19
248912822-Jun-06 2:19 
AnswerRe: inserting 10 rows in a table using a query Pin
Mairaaj Khan22-Jun-06 3:12
professionalMairaaj Khan22-Jun-06 3:12 
AnswerRe: inserting 10 rows in a table using a query Pin
Eric Dahlvang22-Jun-06 6:46
Eric Dahlvang22-Jun-06 6:46 
Questionpassword?!!! Pin
md_refay22-Jun-06 0:38
md_refay22-Jun-06 0:38 
AnswerRe: password?!!! Pin
Colin Angus Mackay22-Jun-06 1:00
Colin Angus Mackay22-Jun-06 1:00 
AnswerRe: password?!!! Pin
r.stropek22-Jun-06 2:13
r.stropek22-Jun-06 2:13 
GeneralRe: password?!!! Pin
Colin Angus Mackay22-Jun-06 4:53
Colin Angus Mackay22-Jun-06 4:53 

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.