Forums (RSS 2.0)" href="http://www.simple-talk.com/community/forums/rss.aspx?ForumID=-1&Mode=0" />
Click here to monitor SSC

SQL Server Excel Workbench

Last post 11-18-2011, 3:11 AM by swapnajeet. 131 replies.
Page 3 of 9 (132 items)   < Previous 1 2 3 4 5 Next > ... Last »
Sort Posts: Previous Next
  •  03-30-2007, 8:16 AM Post number 21605 in reply to post number 71297

    ge: Great scripts

    There are three examples of the use of the stored procedure just after the source of the stored procedure. The DDL is the SQL Data Definition Language command that you want to send to the data source. The DDL commands are defined by ODBC. These ODMC sources must be able to respond to a certain number of these commands, depending whether the ODBC driver is Minimun, Core or Extended.

    I hope that helps!

    see http://www.jsoftware.com/help/user/sql_statements.htm
  •  04-03-2007, 11:53 AM Post number 21951 in reply to post number 71297

    Dumb question

    Hi,
    Really cool stuff. One thing I seem to be missing though; how do you fill the spreadsheet with data from sql server as opposed to explicitly indicating the values you want to insert into the spreadsheet?

    My apologies for the goofy question. It's probably in there somewhere and I missed it.

    Many thanks!
  •  04-12-2007, 6:49 AM Post number 22640 in reply to post number 71297

    next step - array functions

    Another Excellent Article! Thanks for the great detail Robyn and Phil!

    Using similiar steps as in your article, I am creating an Excel worksheet with two sheets from SQL; the second sheet is a summary of the data in the first sheet.
    In my testing I create the summary sheet with SQL as well and that works of course.
    For formating (ease of viewing) however I would like to use Excel functions in the second sheet.
    Examples:
    {=SUMPRODUCT((Sheet1!J2:J40)*(Sheet1!$I$2:$I$40="PartA"))}
    or
    {=SUM(VALUE(Sheet1!J2:J40))}
    or
    {=COUNT(VALUE(Sheet1!J2:J40))}

    The "Rub" is that to enter an array function into an Excel Cell you must type it without the curly brackets and hit CTRL + SHIFT + ENTER.

    I cannot recreate this in SQL to insert the Array Function into the Cell...

    Any ideas?

    I thought about recording a Macro and having that run when the Worksheet was opened; how do I insert a Macro into a new sheet from SQL?
    At the end of my SQL Script I also email the Excel as an attachment to the User - they need to be able to open the Worksheet with few if not zero steps... (nothing new there...)

    Thanks!
    Todd
  •  04-13-2007, 10:09 AM Post number 22769 in reply to post number 71297

    64-bit server issue for ADODB

    Great article! Finally I've found other who are trying to solve the same problems that I am.

    One issue I've encountered though. The Microsoft.Jet.OLEDB.4.0 driver does not exist for 64-bit Windows Servers AND Microsoft apparently has no plans to create one. Very little info from Microsoft on this topic (http://connect.microsoft.com/SQLServer/feedback/Vote.aspx?FeedbackID=125117).
  •  04-14-2007, 8:14 AM Post number 22875 in reply to post number 71297

    re: Next Step Array functions

    You can insert formulas into Excel just as easily as you do values from TSQL. I'm sorry if we didn't quite make that clear. you just assign your formula to the .FORMULA attribute of the cell or cell range. You'll see in the example in the article where we assign to the .VALUE of a cell to insert the resultset values into excel. You just do the same, but assign to the .FORMULA

    Good luck and let us know how you get on!
  •  04-14-2007, 8:24 AM Post number 22876 in reply to post number 71297

    re 64-bit Server Issue for ADODB

    This is an 'interesting' problem. The way I get around this is to use a linked SQL Server Express 'Grunt' server to do this sort of job, on a 32-bit machine. Works fine: no hassle. But it aint the perfect solution.

    I've heard that one can get ODBC to work by running C:\WINDOWS\SysWOW64\odbcad32.exe but I've never tried it.
  •  06-21-2007, 10:56 AM Post number 32585 in reply to post number 71297

    Script generating an error...

    Hi Robyn,
    Hi Phil,
    Thanks for the great work you've been doing. I think this would be a very useful script for me to have. However having copied it from the site (in steps of course)I find that I'm getting the error... "Msg 50000, Level 16, State 1, Procedure spDMOExportToExcel, Line 249
    Error whilst Creating the Excel Application, on MyServer, sp_OAMethod usage: ObjPointer int IN, MethodName varchar IN [, @returnval <any> OUT [, additional IN, OUT, or BOTH params]]"
    So I know it has to do with the excel application (which exists) but not what to do about it. Any light for the darkness of this newbie?
    Thanks
  •  06-21-2007, 1:25 PM Post number 32591 in reply to post number 71297

    Re: Script generating an error...

    Copy the script from the box at the top of the article. it is more reliable. Click on where CODE DOWNLOAD is written. The error means that there is a parameter missing in the call to the sp_oaMethod is being called to create the OLE object. As far as I'm aware, the code itself is OK, so I suspect something got lost when you pasted it in. Let us know if that doesn't solve the problem

    We're glad you like the article. I use the code a lot myself.
  •  06-22-2007, 11:56 AM Post number 32664 in reply to post number 71297

    Re: Re: Script generating an error...

    Hi Phil (and Robyn), thanks for the quick response. I did as suggested but I still get that same error message. I thought it might be related to the surface area configuration so I ensured that OLE automation was enabled as well as xp_cmdshell. However that hasn't made a difference. Any other ideas? I've already got three assignments that could use this approach once I get it working. Thanks again...
  •  06-22-2007, 3:01 PM Post number 32677 in reply to post number 71297

    error 0x80004005

    Hi Robyn and Phil,
    as everybody, i love your solution. It was going to help me a lot (36 servers on which some results are to be published).
    I tested on my ntb - all went fine.
    But ... On the first server I went to test, I can't get after EXEC @hr=sp_OAMethod @objconnection, 'Open' - I keep getting that weird error code, with no additional info ...Did you ever get this one ?
    Thanks a lot !
  •  06-25-2007, 2:35 AM Post number 32830 in reply to post number 71297

    Re: Re: Script generating an error...

    Hi Phil (and Robyn), thanks for the quick response. I did as suggested but I still get that same error message. I thought it might be related to the surface area configuration so I ensured that OLE automation was enabled as well as xp_cmdshell. However that hasn't made a difference. Any other ideas? I've already got three assignments that could use this approach once I get it working. Thanks again...
  •  06-25-2007, 7:40 PM Post number 32877 in reply to post number 71297

    Deleting the spreadsheet rows

    Great work on this. Extremely helpful.

    I am able to populate the spreadsheet with data selected from my sql db using an "insert into", and I can update specified rows.

    But I cannot determine how to delete all rows. Maybe I missed something in your detail. I tried the following script

    delete OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',

    'Data Source="\\FS1\DriveF\Misc-Admin\JobInfo\New.xls"
    ;User ID=Admin;Password=;Extended properties=Excel 8.0')
    ...Newtab$

    and get the following error

    Server: Msg 7345, Level 16, State 1, Line 1
    OLE DB provider 'Microsoft.Jet.OLEDB.4.0' could not delete from table 'Newtab$'. There was a recoverable, provider-specific error, such as an RPC failure.
    [OLE/DB provider returned message: Deleting data in a linked table is not supported by this ISAM.]
    OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IRowsetChange::DeleteRows returned 0x80040e21: DBROWSTATUS_E_FAIL].

    If I remove the ...Newtab$, I get the following error

    Server: Msg 170, Level 15, State 1, Line 4
    Line 4: Incorrect syntax near ')'.

    Could you plz assist. Thanks


  •  06-25-2007, 7:42 PM Post number 32878 in reply to post number 71297

    Deleting the spreadsheet rows

    Great work on this. Extremely helpful.

    I am able to populate the spreadsheet with data selected from my sql db using an "insert into", and I can update specified rows.

    But I cannot determine how to delete all rows. Maybe I missed something in your detail. I tried the following script

    delete OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',

    'Data Source="\\FS1\DriveF\Misc-Admin\JobInfo\New.xls"
    ;User ID=Admin;Password=;Extended properties=Excel 8.0')
    ...Newtab$

    and get the following error

    Server: Msg 7345, Level 16, State 1, Line 1
    OLE DB provider 'Microsoft.Jet.OLEDB.4.0' could not delete from table 'Newtab$'. There was a recoverable, provider-specific error, such as an RPC failure.
    [OLE/DB provider returned message: Deleting data in a linked table is not supported by this ISAM.]
    OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IRowsetChange::DeleteRows returned 0x80040e21: DBROWSTATUS_E_FAIL].

    If I remove the ...Newtab$, I get the following error

    Server: Msg 170, Level 15, State 1, Line 4
    Line 4: Incorrect syntax near ')'.

    Could you plz assist. Thanks


  •  06-27-2007, 1:23 PM Post number 32985 in reply to post number 71297

    re:Deleting the spreadsheet rows

    Yes. Isn't it strange. It looks from the error message that the OLEDB provider doesn't even support deletion of rows. I often have to shrug and go back to doing a full automation of Excel when something simple doesn't work!
    Try the link approach, but I suspect that will not work either
  •  08-02-2007, 9:22 AM Post number 34328 in reply to post number 71297

    255 chars

    Good morning and thanks for the above. The issue that i am having with this and hope that you have found a workaround is for fields with more than 255 chars. Seems that utilizing Microsoft.Jet.OLEDB.4.0 , Excel 8.0 will throw an error "Msg 8152, Level 16, State 4, Line 1
    String or binary data would be truncated." I have tried the tweak at http://support.microsoft.com/kb/189897/EN-US/ to no avail. any help would be greatlt appreciated!
    steve@nyctechsupport.com
Page 3 of 9 (132 items)   < Previous 1 2 3 4 5 Next > ... Last »
View as RSS news feed in XML