March 4, 2007 at 9:20 pm
Hi,
i need help on this.
i want to write a stored procedure and pass following two input parameters
1. MS_ID
2. Project_Phase_ID
AFter passing the parameters i want to select the following below from a table called Cost_Project
Gross_Square_Footage
Construction_Budget (Construction Cost + Soft Cost)
Last_Updated_By
Last_Updated_Dt
FYI the structure of the table Cost_Project is as below
USE [Entity]
GO
/****** Object: Table [dbo].[COST_Project] Script Date: 03/04/2007 23:11:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[COST_Project](
[MS_ID] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Project_Phase_ID] [int] IDENTITY(1,1) NOT NULL,
[Gross_Square_Footage] [int] NOT NULL,
[Construction_Cost] [int] NULL,
[Soft_Cost] [int] NULL,
[Phase_Note] [varchar](100) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Last_Updated_Dt] [datetime] NULL,
[Last_Updated_By] [varchar](60) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [XPKCOST_Project_Phase] PRIMARY KEY NONCLUSTERED
(
[MS_ID] ASC,
[Project_Phase_ID] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
March 5, 2007 at 1:29 am
Hi,
I think you probably want somthing along the lines of:
CREATE
PROCEDURE sp_Project_Step_Cost
@MS_ID varchar
(10),
@Project_Phase_ID
INT
AS
SELECT Gross_Square_Footage,
Construction_Cost
+ Soft_Cost AS Construction_Budget,
Last_updated_By
,
Last_Updated_Dt
FROM
COST_Project
WHERE MS_ID = @MS_ID AND Project_Phase_ID = @Project_Phase_ID
GO
--EXECUTE CostProcedure @MS_ID = '', @Project_Phase_ID = 0
- James
--
James Moore
Red Gate Software Ltd
March 5, 2007 at 6:49 am
Thanks for the help
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply