December 10, 2012 at 4:06 am
Hi There pls assist.
I am trying to create a package that will query sql server and return results to excel, this package should replace existing data on the excel with new data everytime it runs.
currently I tried using two sql tasks one to drop the table and one to create. when I run the drop table task it only clears the headings.
please assist.
Kind Regards
December 10, 2012 at 6:52 am
How about TRUNCATE TABLE or DELETE * FROM TABLE ?
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
December 10, 2012 at 9:22 am
If all of the data on all of the tabs in the file are refreshed each time, you might consider dropping and recreating the excel file with each run.
December 10, 2012 at 10:09 am
You could also create a "template" so to speak, with the necessary tabs with column headers only, from the resulting spreadsheet, and copy it over the exsting spreadsheet each time in a prior step.
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
December 10, 2012 at 6:12 pm
I agree with sgmunson. Back in the day when I did alot of DTS work, both the truncate table and delete from table would work fine. The syntax for the name of the tab was a little weird. Just google around.
Good luck
John Miner
CraftyDBA
John Miner
Crafty DBA
www.craftydba.com
December 10, 2012 at 11:36 pm
Hi Guys,
I tried delete * from table_name, but I get this error :
[Execute SQL Task] Error: Executing the query "delete * from Data_Destination" failed with the following error: "Deleting data in a linked table is not supported by this ISAM.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
I tried truncate table table_name, but I get this error :
[Execute SQL Task] Error: Executing the query "truncate table Data_Destination" failed with the following error: "Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
December 11, 2012 at 2:01 am
The Excel SQL syntax (or whatever it is called) is more like this:
DELETE * FROM [mySheet$]
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
December 11, 2012 at 2:12 am
Thanks for the feedback I went with deleting and recreating the file and it worked fine. thanks everyone
December 13, 2018 at 2:48 pm
I know this post is old, but for anyone stumbling onto the forum looking for a way reset the "Name of Excel sheet" inside of the Excel Destination - you cannot use DROP TABLE [tableName$];. What you have to realize is that the CREATE TABLE statement you made by clicking "New..." actually created a spreadsheet at the destination. You have to delete the spreadsheet before you on the file system/windows explorer before trying to recreate a new table. This often happens when your first attempt uses the wrong Data Type in Excel, and you get the error "Cannot convert between unicode and non-unicode string data types".
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply