Loading ...
Sorry, an error occurred while loading the content.

Re: [mugh-sqlcon] query + sql Server 2000 sp + table variable

Expand Messages
  • Durgaprasad Ch
    Hi Amit, Could you copy entire proc !! Or just specify what error exactly you are getting. Thanks, Durga amit g wrote: hi, i m nt an
    Message 1 of 4 , Sep 1, 2004
    View Source
    • 0 Attachment
      Hi Amit,
       
      Could you copy entire proc !! Or just specify what error exactly you are getting.
       
       
      Thanks,
      Durga

      amit g <ssp_amit222@...> wrote:
      hi,
       
      i m nt an expert on database and jst started to explore the thngs ... and this is my first post to this group... i aspire to become DBA one day .....
       
       
      my query is as follows :
       
      // SQL server 2000 sp code snippet that i wz trying
       
      declare @temp as table(.....) /* table variable */
      declare @strSqlPart  as varchar(100)
      .....
      ....
      set @strSql = ' Select '  + @strSqlPart + '  From ' + @table
      exec(@strSql)    /// i wz getting error here .....
       
      pls explain....
       
       
      regds
      Amit


      Do you Yahoo!?
      Win 1 of 4,000 free domain names from Yahoo! Enter now.

      SqlCon is a special interests group run under the aegis of MUGH - http://www.mugh.net
      http://www.mugh.net/sql

      Visit http://www.mugh.net/dnug to join .NET User Group.



      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com

    • PRASHANT PADMANNAVAR
      Hi Amit, declare @strSql as varchar(1000) DECLARE @strSqlPart as VARCHAR(200) DECLARE @table as VARCHAR(255) SELECT @table = Application SELECT
      Message 2 of 4 , Sep 5, 2004
      View Source
      • 0 Attachment
        Hi Amit,

        declare @strSql as varchar(1000)
        DECLARE @strSqlPart as VARCHAR(200)
        DECLARE @table as VARCHAR(255)

        SELECT @table = ' Application '
        SELECT @strSqlPart =' [ApplicationID],
        [ApplicationName] '

        set @strSql = ' Select ' + @strSqlPart + ' From ' +
        @table
        exec(@strSql)

        This is working fine for me

        Let us know what error are you getting?

        Thanks,
        paddy

        --- amit g <ssp_amit222@...> wrote:

        > hi,
        >
        > i m nt an expert on database and jst started to
        > explore the thngs ... and this is my first post to
        > this group... i aspire to become DBA one day .....
        >
        >
        > my query is as follows :
        >
        > // SQL server 2000 sp code snippet that i wz trying
        >
        > declare @temp as table(.....) /* table variable */
        > declare @strSqlPart as varchar(100)
        > .....
        > ....
        > set @strSql = ' Select ' + @strSqlPart + ' From '
        > + @table
        > exec(@strSql) /// i wz getting error here .....
        >
        > pls explain....
        >
        >
        > regds
        > Amit
        >
        >
        > ---------------------------------
        > Do you Yahoo!?
        > Win 1 of 4,000 free domain names from Yahoo! Enter
        now.




        __________________________________
        Do you Yahoo!?
        New and Improved Yahoo! Mail - Send 10MB messages!
        http://promotions.yahoo.com/new_mail
      Your message has been successfully submitted and would be delivered to recipients shortly.