Query containing table variable returning no rows at runtime

  • Hi folks,

    I have a query containing table variables for an Ole Db source. The designer correctly deduced the columns from the query and when I hit the Preview button, it shows the data correctly. But when I execute the task, no rows are returned. Am i missing something? Here's a sample query containing the table variable:

    declare @mytable table

    (

    col1 int,

    col2 varchar(20)

    )

    insert @mytable values (1, 'one')

    insert @mytable values (2, 'two')

    insert @mytable values (3, 'three')

    select * from @mytable

    Regards,

    Syed Mehroz Alam
    MyBlog | MyArticles

  • Problem solved. I posted at TechNet forum and got an answer here. Actually, I was missing a SET NOCOUNT ON statement.

    Cheers,

    Syed Mehroz Alam
    MyBlog | MyArticles

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

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