Click here to Skip to main content
15,920,005 members
Home / Discussions / Database
   

Database

 
GeneralNo data found, but HasRows Pin
Vector718-Nov-04 6:14
Vector718-Nov-04 6:14 
GeneralRe: No data found, but HasRows Pin
lokin118-Nov-04 6:49
lokin118-Nov-04 6:49 
GeneralEvaluating decimal type Pin
totig18-Nov-04 1:11
totig18-Nov-04 1:11 
GeneralRe: Evaluating decimal type Pin
Colin Angus Mackay18-Nov-04 1:37
Colin Angus Mackay18-Nov-04 1:37 
GeneralParadox Binary Blob Pin
elapid18-Nov-04 0:53
elapid18-Nov-04 0:53 
GeneralUpdate Pin
vuthaianh17-Nov-04 16:56
vuthaianh17-Nov-04 16:56 
GeneralRe: Update Pin
Edbert P17-Nov-04 19:18
Edbert P17-Nov-04 19:18 
GeneralMultiple INSERTs in a Stored Procedure Pin
Luis Alonso Ramos17-Nov-04 6:58
Luis Alonso Ramos17-Nov-04 6:58 
Hello,

I have three tables: Distributors, Business, Users. The Distributors table only has three fields: ID_distributor, an ID_Business, and an ID_repr (like the boss of that distributor). The Business table has information about the business (Name, Address and so on) and the User table about people accesing the web site (login name, password, and the ID_business they belong to.)

So, I want to insert a new Distributor from a web page. I need to first add a new Business record, and then (in any order) the Distributor record and the User record. (EDIT: Obviously, I want to store the first record's ID in the other two tables, to keep the relation. @@IDENTITY would help here, wouldn't it?))

And finally, I need it to return all the three IDs (distributor, business and user).

I've never written a stored procedure by hand (only designed them with Access) so I have no idea of the syntax. There are many more fields, but I'd like just to see the general structure of that stored procedure and how to use output parameters and so on.

Thanks in advance,

-- LuisR



Luis Alonso Ramos
Intelectix - Chihuahua, Mexico

Not much here: My CP Blog!

GeneralRe: Multiple INSERTs in a Stored Procedure Pin
Edbert P17-Nov-04 19:31
Edbert P17-Nov-04 19:31 
GeneralRe: Multiple INSERTs in a Stored Procedure Pin
Luis Alonso Ramos18-Nov-04 6:59
Luis Alonso Ramos18-Nov-04 6:59 
GeneralWHERE X IN QueryY - Parameters Pin
Tristan Rhodes17-Nov-04 3:11
Tristan Rhodes17-Nov-04 3:11 
GeneralRe: WHERE X IN QueryY - Parameters Pin
Mike Ellison17-Nov-04 6:30
Mike Ellison17-Nov-04 6:30 
GeneralRe: WHERE X IN QueryY - Parameters Pin
Tristan Rhodes17-Nov-04 22:31
Tristan Rhodes17-Nov-04 22:31 
GeneralRe: WHERE X IN QueryY - Parameters Pin
Mike Ellison18-Nov-04 8:41
Mike Ellison18-Nov-04 8:41 
GeneralRe: WHERE X IN QueryY - Parameters Pin
Tristan Rhodes18-Nov-04 23:39
Tristan Rhodes18-Nov-04 23:39 
Generalcannot execute dts packages with asp.net Pin
steven_wong16-Nov-04 16:38
steven_wong16-Nov-04 16:38 
GeneralRe: cannot execute dts packages with asp.net Pin
minhpc_bk16-Nov-04 18:56
minhpc_bk16-Nov-04 18:56 
GeneralRe: cannot execute dts packages with asp.net Pin
steven_wong17-Nov-04 22:16
steven_wong17-Nov-04 22:16 
GeneralRe: cannot execute dts packages with asp.net Pin
minhpc_bk18-Nov-04 22:54
minhpc_bk18-Nov-04 22:54 
GeneralRe: cannot execute dts packages with asp.net Pin
steven_wong20-Nov-04 16:27
steven_wong20-Nov-04 16:27 
GeneralRe: cannot execute dts packages with asp.net Pin
minhpc_bk21-Nov-04 23:16
minhpc_bk21-Nov-04 23:16 
GeneralRe: cannot execute dts packages with asp.net Pin
minhpc_bk25-Nov-04 13:44
minhpc_bk25-Nov-04 13:44 
GeneralCRecordset Edit Pin
Shotgun16-Nov-04 14:45
Shotgun16-Nov-04 14:45 
GeneralSQLDataReader for image type Pin
mysorian16-Nov-04 12:09
professionalmysorian16-Nov-04 12:09 
GeneralRe: SQLDataReader for image type Pin
Luis Alonso Ramos21-Nov-04 15:25
Luis Alonso Ramos21-Nov-04 15:25 

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.