passing column name to stored procedure

  • Does anyone know how to do that?

    Would you please enlighten me if you do?

  • What do you mean exactly?

    Pass it to your stored procedure as a VARCHAR() and use it in your query with the EXEC sql command.

    Ex for dynamic sql:

    DECLARE @MyColumn AS VARCHAR(80) ; SET @MyColumn = 'name'

    EXEC('SELECT ' + @MyColumn + ' FROM sysobjects')

    Or retrieve the column you want from the table syscolumns

    I hoped that helps.

    Edited by - hanslindgren on 03/03/2003 10:07:12 AM

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

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