Click here to Skip to main content
15,900,461 members
Home / Discussions / Database
   

Database

 
GeneralRe: T-SQL USE with a variable Pin
Blue_Boy6-Jul-09 7:09
Blue_Boy6-Jul-09 7:09 
GeneralRe: T-SQL USE with a variable Pin
TheComputerMan6-Jul-09 21:51
TheComputerMan6-Jul-09 21:51 
GeneralRe: T-SQL USE with a variable Pin
DoctorMick7-Jul-09 2:04
DoctorMick7-Jul-09 2:04 
GeneralRe: T-SQL USE with a variable Pin
TheComputerMan7-Jul-09 3:25
TheComputerMan7-Jul-09 3:25 
QuestionBest Way to Sync SQL Srv Databases Pin
Pago0076-Jul-09 3:58
Pago0076-Jul-09 3:58 
AnswerRe: Best Way to Sync SQL Srv Databases Pin
DoctorMick6-Jul-09 6:23
DoctorMick6-Jul-09 6:23 
AnswerRe: Best Way to Sync SQL Srv Databases Pin
dingoishere23-Feb-11 22:30
dingoishere23-Feb-11 22:30 
QuestionSchema Question Pin
Paul Unsworth6-Jul-09 3:13
Paul Unsworth6-Jul-09 3:13 
AnswerRe: Schema Question Pin
DoctorMick6-Jul-09 6:24
DoctorMick6-Jul-09 6:24 
AnswerRe: Schema Question Pin
David Mujica6-Jul-09 10:23
David Mujica6-Jul-09 10:23 
GeneralRe: Schema Question Pin
Paul Unsworth6-Jul-09 21:42
Paul Unsworth6-Jul-09 21:42 
GeneralRe: Schema Question Pin
David Mujica7-Jul-09 2:57
David Mujica7-Jul-09 2:57 
GeneralRe: Schema Question Pin
Paul Unsworth7-Jul-09 3:14
Paul Unsworth7-Jul-09 3:14 
GeneralAlong with security, consider auditing Pin
David Mujica7-Jul-09 3:25
David Mujica7-Jul-09 3:25 
GeneralRe: Along with security, consider auditing Pin
Paul Unsworth7-Jul-09 4:28
Paul Unsworth7-Jul-09 4:28 
QuestionIF else or Case when Pin
Vimalsoft(Pty) Ltd6-Jul-09 2:34
professionalVimalsoft(Pty) Ltd6-Jul-09 2:34 
AnswerRe: IF else or Case when Pin
DoctorMick6-Jul-09 6:28
DoctorMick6-Jul-09 6:28 
GeneralRe: IF else or Case when Pin
Vimalsoft(Pty) Ltd6-Jul-09 19:58
professionalVimalsoft(Pty) Ltd6-Jul-09 19:58 
QuestionSelect null value Pin
yesu prakash6-Jul-09 2:20
yesu prakash6-Jul-09 2:20 
AnswerRe: Select null value Pin
Eddy Vluggen6-Jul-09 3:28
professionalEddy Vluggen6-Jul-09 3:28 
AnswerRe: Select null value Pin
Niladri_Biswas6-Jul-09 15:51
Niladri_Biswas6-Jul-09 15:51 
QuestionSQL Stored Procedure INSERT with random records from a 2nd table [modified] Pin
munklefish6-Jul-09 0:46
munklefish6-Jul-09 0:46 
Hi,

I need to submit data from a form to an SQL2005 database via a stored procedure. The difficult part is that i also need to get 5 random records from a secondary table and insert these as part of the inserted record in table 1.

My structure is akin to this:

Tbl_Campaigns (table to be inserted to)

Key | field_1 | field_2 | field_3 | field_4 | field_5 etc



Tbl_Organisations (table to get the 5 random records from)

Key | field_1 



I need to get 5 unique / random records from 'tbl_Organisations', catch them and insert them into a single record along with the data input to the stored procedure. I understand arrays arent an option in SQL2005(?).

So how do i catch these records and then insert them as a single record along with the SP Inputs?

Any help would be greatly appreciated as i am trying my best to get to grips with the complexities of SQL

Thanks.

modified on Tuesday, July 7, 2009 6:04 AM

AnswerRe: SQL Stored Procedure INSERT with random records from a 2nd table Pin
DoctorMick6-Jul-09 1:05
DoctorMick6-Jul-09 1:05 
GeneralRe: SQL Stored Procedure INSERT with random records from a 2nd table Pin
munklefish6-Jul-09 1:09
munklefish6-Jul-09 1:09 
GeneralRe: SQL Stored Procedure INSERT with random records from a 2nd table Pin
Blue_Boy6-Jul-09 6:11
Blue_Boy6-Jul-09 6:11 

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.