SQL Examples
MySQL
Campaign Query
CREATE PROCEDURE `getNJCampaigns`() BEGIN select campaignName, campaignId from tblCampaign; END
List Query
CREATE PROCEDURE `getNJLeads`(campaignId int) BEGIN select phone, firstname, surname , street, suburb, postcode from tblLeads where tblLeads.campaignid = campaignId; END
Microsoft SQL Server
USE [YourDatabaseName] GO /****** Object: StoredProcedure [dbo].[getNJCampaigns] ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[getNJCampaigns] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; select campaignName, campaignId from tblCampaign; END ALTER PROCEDURE [dbo].[getNJLeads] @campaignId int AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; select phone, firstname, surname , street, suburb, postcode from tblLeads where tblLeads.campaignid = @campaignId END