Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)

  • RE: problem in stored procedure

    SOLVED:

    ALTER PROCEDURE GetMaxCostCenterValue

    (

    @CostCenter nvarchar(225),

    @DateFrom datetime,

    @DateTo datetime

    )

    AS

    SET NOCOUNT ON

    BEGIN

    DECLARE @Query NVARCHAR(525)

    DECLARE @pn_CostCenter NVARCHAR(525)

    SET @Query = N'SELECT

    dbo.Formatdate(m.Month) As Financial_Month

    , d.Dept_name

    ,m.'+@CostCenter+'

    FROM

    tblMasterTable m

    INNER JOIN tbldept d

    ON d.Dept_ID = m.dept

    Where

    '+@CostCenter+' =

    (SELECT MAX('+@CostCenter+')...

  • RE: Help in stored procedure

    Im missing these lines

    SET @stmt = LEFT(@stmt, LEN(@stmt) -1)

    SET @Quary = 'SELECT '+@stmt + ' from finance'

    Its resolved, thanks alot

Viewing 2 posts - 1 through 2 (of 2 total)