locked
select * shows 1 record - select count(*) shows 2232 records RRS feed

  • Question

  • Using SQL 2008 R2 and SS Import Wizard

    Imported Excel file into SQL Table.  No errors reported during import.

    Command:  Select * From XLImport

    returns 1 record

    Command: Select Count(*) From XLImport

    returns 2232

    What could be causing this ??

    Many thanks


    MisterT99

    Friday, October 3, 2014 2:09 PM

Answers

  • I see what happened.

    A previous command issued 'Set ROWCOUNT 1'

    When I entered 'Set ROWCOUNT 0'  That fixed the problem.

    Thanks everyone for your comments.


    MisterT99

    • Marked as answer by Mister T99 Friday, October 3, 2014 3:31 PM
    Friday, October 3, 2014 3:31 PM

All replies

  • A bug or a corruption.

    Can you repro importing into a new database?

    David


    David http://blogs.msdn.com/b/dbrowne/

    Friday, October 3, 2014 2:34 PM
  • Hi David,  Thanks for your reply.

    I ran the SS Import Wizard again on the file with the same results.

    The SSIW created all the fields as nvarchar(255).   I changed the fields to varchar(255) and imported again. 

    No difference.

    Very strange

    Thanks


    MisterT99

    Friday, October 3, 2014 2:38 PM
  • Perhaps it is importing empty rows, can you open your table and see? It seems your Excel file is not properly formatted - try explicitly defining the columns in the "options" page

    Satish Kartan www.sqlfood.com

    Friday, October 3, 2014 2:59 PM
  • Hmm..Can you show us a screenshot of query window with queries executed + results?

    I dont expect count to change even in case of empty rows as you're using select *


    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

    Friday, October 3, 2014 3:01 PM
  • Here is a screen shot


    MisterT99

    Friday, October 3, 2014 3:10 PM
  • I see what happened.

    A previous command issued 'Set ROWCOUNT 1'

    When I entered 'Set ROWCOUNT 0'  That fixed the problem.

    Thanks everyone for your comments.


    MisterT99

    • Marked as answer by Mister T99 Friday, October 3, 2014 3:31 PM
    Friday, October 3, 2014 3:31 PM
  • I see what happened.

    A previous command issued 'Set ROWCOUNT 1'

    When I entered 'Set ROWCOUNT 0'  That fixed the problem.

    Thanks everyone for your comments.


    MisterT99

    Cool

    That now makes sense


    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

    Friday, October 3, 2014 3:38 PM