locked
Execute SQL Task RRS feed

  • Question

  • Hi,
    SELECT        MAX(CmtID) AS CmtID
    FROM            dbo.CADCmt...
    i declared this query in Execute SQL Task...
    i want to use that CmtID....how can i get that from Execute SQL Task.. 
    Thanks,
    Prakash
    • Moved by Calvin_Gao Tuesday, October 25, 2011 6:34 AM (From:Excel for Developers)
    Tuesday, October 18, 2011 10:52 AM

Answers

All replies

  • When you perform an execute on a dbo database it just execute the command on the remote database and doesn't return any data.  It "MAY" be creating a new table or updating the table, but it is not retruning anything.  If you need to look at the new/updated table you need to connect the the table.  Then get the data from the table

    Another method for retrieving data is to return the data to a recordset.  Rather than executing a SQL task Open a recordset with the SQL statement.  The problem is some Functions don't always work from Excel code.  You won't be able to get CmtID but you will be able to read the data in Field CMT from the record set.

     


    jdweng
    Tuesday, October 18, 2011 12:23 PM
  • Should this go in an SQL forum? If so, which one?

    Thanks!


    Ed Price a.k.a User Ed, Microsoft Experience Program Manager (Blog, Twitter, Wiki)
    Sunday, October 30, 2011 9:27 AM
  • Since this is an Excel issue I think it belongs here.  Sometimes I recommend for SQL issues to be posted on the Access for developers site because Excel VBA and Access VBA are very similar.  In this case where from excel you cannot execute a query that contains an access function, thie issue is excel specific.

    I don't remember the specific restrictions of running access queries from excel and if these restrictions apply to all methods and all version of office.  If you can help I would appreciate it.  I know there have been postings where a user tried to use IIF from excel and it wouldn't work.


    jdweng
    Sunday, October 30, 2011 9:51 AM
  • Since this is an Excel issue I think it belongs here.  Sometimes I recommend for SQL issues to be posted on the Access for developers site because Excel VBA and Access VBA are very similar.  In this case where from excel you cannot execute a query that contains an access function, thie issue is excel specific.

    I don't remember the specific restrictions of running access queries from excel and if these restrictions apply to all methods and all version of office.  If you can help I would appreciate it.  I know there have been postings where a user tried to use IIF from excel and it wouldn't work.


    jdweng


    So you think it should be moved back to the Excel forum it was at? (It was moved to Off Topic.) Or should it be posted to the User Excel forum (on www.answers.microsoft.com)?

    Thanks!


    Ed Price a.k.a User Ed, Microsoft Experience Program Manager (Blog, Twitter, Wiki)
    Sunday, October 30, 2011 9:56 AM
  • It looks like he solved his problem at this posting

    http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/d07a21cb-c025-4ab7-be24-72ecb0bef4ff/#6ea1cd1f-f5c5-4de8-8e0a-0886758153b3

    I went back to Prakash profile and looked for additional postings. 


    jdweng
    Sunday, October 30, 2011 10:32 AM