Click here to Skip to main content
15,895,746 members
Home / Discussions / Database
   

Database

 
GeneralRe: i want a to get a SQL Pin
Pete O'Hanlon29-Jun-11 23:40
mvePete O'Hanlon29-Jun-11 23:40 
GeneralRe: i want a to get a SQL Pin
Corporal Agarn30-Jun-11 1:47
professionalCorporal Agarn30-Jun-11 1:47 
GeneralRe: i want a to get a SQL PinPopular
Pete O'Hanlon30-Jun-11 1:57
mvePete O'Hanlon30-Jun-11 1:57 
GeneralRe: i want a to get a SQL Pin
Matt U.30-Jun-11 11:28
Matt U.30-Jun-11 11:28 
GeneralRe: i want a to get a SQL Pin
R. Giskard Reventlov1-Jul-11 2:51
R. Giskard Reventlov1-Jul-11 2:51 
GeneralRe: i want a to get a SQL Pin
crocks2564-Jul-11 1:32
crocks2564-Jul-11 1:32 
QuestionAssistance with a Stored Proc working with the return results from another SP Pin
Alaric_29-Jun-11 5:47
professionalAlaric_29-Jun-11 5:47 
AnswerRe: Assistance with a Stored Proc working with the return results from another SP [modified] Pin
Alaric_29-Jun-11 6:35
professionalAlaric_29-Jun-11 6:35 
Ok...so I'm still working through this scenario, and I've run across a possible lead to accomplish what I desire. If anyone has any feedback into the following approach, I would appreciate it.

My application has a singular entry point into the database. For now, let's call it "ExecuteCampaignOperationLogic" that takes in 2 parameters: campaignName, OperationCode.

Production Data Model:
create table Campaign
(
    CampaignName varchar(50) Constraint PK_Campaign PRIMARY KEY,
    CampaignMission varchar(max)
)
insert into Campaign(CampaignName, CampaignMission) values('StarTrek','5 year mission to
 explore new worlds. To seek out new life and new civilization');

create table Operations
(
    OperationCode VARCHAR(30) CONSTRAINT PK_Operations PRIMARY KEY
)
insert into Operations(OperationCode) values('EngageWarp');
insert into Operations(OperationCode) values('ComeInPeace');
insert into Operations(OperationCode) values('ShootToKill');

create table CampaignOperations
(
   CampaignName VARCHAR(50),
   OperationCode Varchar(30),
   [Procedure] VarChar(max),
   CONSTRAINT FK_Campaign_CampaignOperations FOREIGN KEY (CampaignName) REFERENCES Campaigns(CampaignName),
   CONSTRAINT FK_Operations_CampaignOperations FOREIGN KEY (OperationCode) REFERENCES Operations(OperationCode),
   CONSTRAINT PK_CampaignOperations PRIMARY KEY (CampaignName, OperationCode)
)
insert into CampaignOperations('StarTrek','EngageWarp', 'Reporting.StarTrekWarpAlgorithm');
insert into CampaignOperations('StarTrek','ComeInPeace', 'Reporting.StarTrekConTheLocals');
insert into CampaignOperations('StarTrek','ShootToKill', 'Reporting.StarTrekTakeMoneyAndWomens');


So...I want "ExecuteCampaignOperationLogic" to take the CampaignName + OperationCode into the CampaignOperations table, pull the appropriate Procedure name, execute it, receive the returned resultset, adapt the results to a canonical representation of the Campaign data, and toss back to the calling client, which will be responsible for mapping this data to a Business Object.

Here's what I'm trying:
CREATE PROCEDURE ExecuteCampaignOperationLogic
(
	@CampaignName varchar(50),
	@OperationCode varchar(10)
)
AS
BEGIN
	DECLARE @PROCEDURE varchar(100)
	 
	
	SELECT	@PROCEDURE = [CampaignOperations].[Procedure]
	FROM [CampaignOperations]
		WHERE CampaignName = @CampaignName
		  and OperationCode = @OperationCode

	CREATE TABLE #foobar
	(
		foo varchar(10),
		bar varchar(10)
	)
	INSERT INTO #foobar (foo, bar) exec @PROCEDURE
        SELECT * from #foobar
END

...anyone see any potential for this technique?
"I need build Skynet. Plz send code"

modified formatting on Wednesday, June 29, 2011 12:55 PM

GeneralRe: Assistance with a Stored Proc working with the return results from another SP Pin
Alaric_29-Jun-11 11:23
professionalAlaric_29-Jun-11 11:23 
GeneralRe: Assistance with a Stored Proc working with the return results from another SP Pin
JOAT-MON30-Jun-11 8:22
JOAT-MON30-Jun-11 8:22 
GeneralRe: Assistance with a Stored Proc working with the return results from another SP Pin
Alaric_1-Jul-11 5:01
professionalAlaric_1-Jul-11 5:01 
GeneralRe: Assistance with a Stored Proc working with the return results from another SP Pin
Alaric_1-Jul-11 8:45
professionalAlaric_1-Jul-11 8:45 
GeneralRe: Assistance with a Stored Proc working with the return results from another SP Pin
JOAT-MON1-Jul-11 8:56
JOAT-MON1-Jul-11 8:56 
Questionusing ?: operation in sql server 2008 Pin
reza assar29-Jun-11 3:47
reza assar29-Jun-11 3:47 
AnswerRe: using ?: operation in sql server 2008 Pin
dasblinkenlight29-Jun-11 4:29
dasblinkenlight29-Jun-11 4:29 
GeneralRe: using ?: operation in sql server 2008 Pin
reza assar29-Jun-11 5:35
reza assar29-Jun-11 5:35 
GeneralRe: using ?: operation in sql server 2008 Pin
dasblinkenlight29-Jun-11 5:58
dasblinkenlight29-Jun-11 5:58 
GeneralRe: using ?: operation in sql server 2008 Pin
reza assar29-Jun-11 7:36
reza assar29-Jun-11 7:36 
QuestionParameterised SQL Insert fails; plain text Insert works Pin
hairy_hats29-Jun-11 1:53
hairy_hats29-Jun-11 1:53 
AnswerRe: Parameterised SQL Insert fails; plain text Insert works Pin
Mycroft Holmes29-Jun-11 12:57
professionalMycroft Holmes29-Jun-11 12:57 
GeneralRe: Parameterised SQL Insert fails; plain text Insert works Pin
hairy_hats29-Jun-11 21:35
hairy_hats29-Jun-11 21:35 
AnswerRe: Parameterised SQL Insert fails; plain text Insert works Pin
dasblinkenlight29-Jun-11 17:30
dasblinkenlight29-Jun-11 17:30 
QuestionDTS not working in sql 2008 Pin
Robymon28-Jun-11 22:21
Robymon28-Jun-11 22:21 
AnswerRe: DTS not working in sql 2008 Pin
Corporal Agarn29-Jun-11 3:41
professionalCorporal Agarn29-Jun-11 3:41 
AnswerRe: DTS not working in sql 2008 Pin
Mycroft Holmes29-Jun-11 12:59
professionalMycroft Holmes29-Jun-11 12:59 

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.