Results 1 to 3 of 3

Thread: stored procedure

  1. #1
    Harish Guest

    stored procedure

    I amtrying to create the procedure which will give the output to @filename.
    i am using this proccedure in other procedure too.
    and i am geting follwonmg error.Help me !!

    ===============
    create procedure p1 as
    @v datetime,
    @filename varchar output

    begin

    SELECT @v = GetDate()

    select @filename = 'XAPIALTMKT'+CONVERT(varchar, @v, 112)+ SUBSTRING(CONVERT(varchar, @v, 108), 1, 2)
    + SUBSTRING(CONVERT(varchar, @v, 108), 4, 2)+ SUBSTRING(CONVERT(varchar, @v, 108), 7, 2) + '.TXT'

    end

    =======error
    Msg 170, Level 15, State 1
    Line 2: Incorrect syntax near '@v'.
    Msg 137, Level 15, State 1
    Must declare variable '@v'.
    Msg 137, Level 15, State 2
    Must declare variable '@v'.

  2. #2
    vikram Guest

    stored procedure (reply)

    you will have to declare the variables..

    in ur example

    declare @v datetime
    declare @filename varchar output

    regards
    vikram


    ------------
    Harish at 8/28/01 11:09:49 AM

    I amtrying to create the procedure which will give the output to @filename.
    i am using this proccedure in other procedure too.
    and i am geting follwonmg error.Help me !!

    ===============
    create procedure p1 as
    @v datetime,
    @filename varchar output

    begin

    SELECT @v = GetDate()

    select @filename = 'XAPIALTMKT'+CONVERT(varchar, @v, 112)+ SUBSTRING(CONVERT(varchar, @v, 108), 1, 2)
    + SUBSTRING(CONVERT(varchar, @v, 108), 4, 2)+ SUBSTRING(CONVERT(varchar, @v, 108), 7, 2) + '.TXT'

    end

    =======error
    Msg 170, Level 15, State 1
    Line 2: Incorrect syntax near '@v'.
    Msg 137, Level 15, State 1
    Must declare variable '@v'.
    Msg 137, Level 15, State 2
    Must declare variable '@v'.

  3. #3
    Ivo Guest

    stored procedure (reply)


    yes, and if it should @v and @filename to be input parameters, you should place 'as' between them and begin ...


    ------------
    vikram at 8/28/01 2:45:37 PM

    you will have to declare the variables..

    in ur example

    declare @v datetime
    declare @filename varchar output

    regards
    vikram


    ------------
    Harish at 8/28/01 11:09:49 AM

    I amtrying to create the procedure which will give the output to @filename.
    i am using this proccedure in other procedure too.
    and i am geting follwonmg error.Help me !!

    ===============
    create procedure p1 as
    @v datetime,
    @filename varchar output

    begin

    SELECT @v = GetDate()

    select @filename = 'XAPIALTMKT'+CONVERT(varchar, @v, 112)+ SUBSTRING(CONVERT(varchar, @v, 108), 1, 2)
    + SUBSTRING(CONVERT(varchar, @v, 108), 4, 2)+ SUBSTRING(CONVERT(varchar, @v, 108), 7, 2) + '.TXT'

    end

    =======error
    Msg 170, Level 15, State 1
    Line 2: Incorrect syntax near '@v'.
    Msg 137, Level 15, State 1
    Must declare variable '@v'.
    Msg 137, Level 15, State 2
    Must declare variable '@v'.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •