sql problem

  • Hello everyone

    i m a beginner in sql i want to know that

    how to insert a table column as the parameter of a user defined function.

    thanks

  • Can you please show us what you are trying to do, what code have you written so far?

  • i have just created a table with a two columns name serialno and value.

    now i want to create function which can use each value of this column for the calculation.

    in sql

    CREATE TABLE table1

    ( serialno int(),

    value int() ,

    )

  • Hi,

    Are you looking for some thing like given below

    CREATE Function udf_usetablecolumn (@serialno int, @value INT) RETURNS int AS

    Begin

    DECLARE

    @RetValue varchar(1000)

    SET @RetValue = @serialno+@value

    Return @RetValue

    END

    and after creation

    Select dbo.udf_usetablecolum(serialno,value)

  • Hi , please try to keep your related issues to one thread

    http://www.sqlservercentral.com/Forums/Topic781966-324-1.aspx#bm781978



    Clear Sky SQL
    My Blog[/url]

  • Thanks man

    i will try to keep my self on one thread

  • Hi,

    did Srikanth Anumalasetty's reply answer your question?

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • I think he need third column as computed column.

    like if the value column has value '10'

    then he need some computation on value '10' and save it to third column.

    example:

    CREATE TABLE [dbo].[test](

    [id] [int] NOT NULL,

    [value] [int] NOT NULL,

    [value*10] AS ([value]*(10)) ----third computed column

    ) ON [PRIMARY]

  • sorry this one is not required by them.......i misunderstand

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply