Click here to Skip to main content
15,890,882 members
Home / Discussions / Database
   

Database

 
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 
GeneralRe: SQL Stored Procedure INSERT with random records from a 2nd table Pin
munklefish7-Jul-09 0:04
munklefish7-Jul-09 0:04 
Questioni neeed help Pin
mahmoudinirat5-Jul-09 23:32
mahmoudinirat5-Jul-09 23:32 
AnswerRe: i neeed help Pin
DoctorMick6-Jul-09 0:00
DoctorMick6-Jul-09 0:00 
QuestionWant to understand how to fine tune stored procedure in SQL Server 2005? Pin
Sasmi_Office5-Jul-09 20:12
Sasmi_Office5-Jul-09 20:12 
AnswerRe: Want to understand how to fine tune stored procedure in SQL Server 2005? Pin
Blue_Boy5-Jul-09 22:10
Blue_Boy5-Jul-09 22:10 
QuestionTime Difference w.r.t Dates Pin
AliAmjad5-Jul-09 19:37
AliAmjad5-Jul-09 19:37 
AnswerRe: Time Difference w.r.t Dates Pin
Blue_Boy5-Jul-09 20:41
Blue_Boy5-Jul-09 20:41 
GeneralRe: Time Difference w.r.t Dates Pin
AliAmjad5-Jul-09 21:01
AliAmjad5-Jul-09 21:01 
GeneralRe: Time Difference w.r.t Dates Pin
Blue_Boy5-Jul-09 21:39
Blue_Boy5-Jul-09 21:39 
GeneralRe: Time Difference w.r.t Dates Pin
AliAmjad5-Jul-09 21:54
AliAmjad5-Jul-09 21:54 
GeneralRe: Time Difference w.r.t Dates Pin
Blue_Boy5-Jul-09 22:01
Blue_Boy5-Jul-09 22:01 
QuestionBFILE, BLOB?? [modified] Pin
Muammar©4-Jul-09 7:56
Muammar©4-Jul-09 7:56 
AnswerRe: BFILE, BLOB?? Pin
Niladri_Biswas4-Jul-09 18:00
Niladri_Biswas4-Jul-09 18:00 
GeneralRe: BFILE, BLOB?? Pin
Muammar©5-Jul-09 0:40
Muammar©5-Jul-09 0:40 

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.