• Hello,

    I am very new to SQL 2008 Express, and am not that comfortable with stored procedures yet. However, I love your post about exporting to Excel. It will be extremely helpful. I just need some help implementing it.

    I copied the code and changed the lines you indicated: 1,8,9,10,57,58. But actually, line 10 was blank in the copied code, so I added it even though I don't see where the variable is used in the script below. In line 57, I entered the revised path, but couldn't that line be changed to use the @fullFileName variable? Or should @fullFileName be the path without the actual file name?

    The first time I executed the procedure, I received the following error, so I found instructions on Microsoft's website as to how to enable the use of xp_cmdshell, which appeared to work.

    Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1

    SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.

    The second time I ran the procedure, the output was as follows:

    Warning: -w overrides -c.

    SQLState = S0002, NativeError = 208

    Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name '##TempExportData2'.

    SQLState = 37000, NativeError = 8180

    Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.

    NULL

    Do you have any idea what I am doing wrong?

    Thank you so much for any help you're able to give.

    Diana