Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Import and Export/Append to Excel

Author  Topic 

Shanah
Starting Member

3 Posts

Posted - 2011-07-27 : 16:22:08
I am new to writing freehand sql in BO/Toad and looking for a way to do the following:
Note: I can only query against 999 records at a time, with that being said a lot of data that I query contains well over 2k records.

What i would like to do is set up a file to retrieve from excel or csv the first 999 records (i.e. loan number), retrieve my query data and export to an excel file. I don't mind if i export to a csv file but my last column is a comment field and I'm worried about it truncating data (not sure if it will, but seems as though it might pose an issue)...
then I would like for it to proceed to the rows 1000-1998, export and/or append, and repeat until I read the end of my file.
Or...
If I can't append within the same worksheet file, can I export to different sheet names within the same file?

Any suggestions or recommendations would be great! Thank you

Ghanta
Yak Posting Veteran

96 Posts

Posted - 2011-07-27 : 16:25:53
Are you going to use SQL Server?
Go to Top of Page

Shanah
Starting Member

3 Posts

Posted - 2011-07-27 : 16:30:13
Hi Ghanta,
yes I will be using SQL server.
Go to Top of Page

Ghanta
Yak Posting Veteran

96 Posts

Posted - 2011-07-27 : 16:36:47
quote:
Originally posted by Shanah

Hi Ghanta,
yes I will be using SQL server.



In that case load the data into a table.. have an identity field for row number and either use SSIS to export or use bcp export with a while loop or cursor to do export... do not know how big is ur comments column, but it should be ok.
Go to Top of Page

Shanah
Starting Member

3 Posts

Posted - 2011-07-27 : 16:41:47
I am new to writing sql code, other than just generic select statments, so i'm not sure how to even begin to code this. Any assistance would be appreciated.
Go to Top of Page

Ghanta
Yak Posting Veteran

96 Posts

Posted - 2011-07-28 : 00:14:22
quote:
Originally posted by Shanah

I am new to writing sql code, other than just generic select statments, so i'm not sure how to even begin to code this. Any assistance would be appreciated.



Check this http://www.sqlservercentral.com/Forums/Topic487837-19-1.aspx

Go to Top of Page
   

- Advertisement -