Home Forums SQL Server 2008 SQL Server Newbies Afficher le résultat de la procédure DetailRapport sous excel RE: Afficher le résultat de la procédure DetailRapport sous excel

  • I can't speak French but I can tell you where the problems are in your code. First is the procedure declaration. You were missing parenthesis around your parmeters. Second issue is the code after your procedure. You were missing the single quotes around your xml.

    Here are the two pieces with valid syntax.

    CREATE PROCEDURE [dbo].[SP_CLR_Export_Excel]

    (

    -- Add the parameters for the stored procedure here

    @proc [nvarchar](100),

    @path [nvarchar](200),

    @filename [nvarchar](100),

    @params xml

    )AS EXTERNAL NAME SP_CLR_ExportToExcel.StoredProcedure.ExportToExcel

    GO

    DECLARE @path varchar(4000),

    @file varchar(4000),

    @params XML

    SET @path = 'C:\XLS\'

    SET @file = 'MonfichierExcel'

    -- les Paramètres de la procédure appelées

    SET @params = '<params> <param name="@pUserID" value="null ">

    <param name="@pDepartmentID" value="null ">

    <param name="@pStartDate" value="null ">

    <param name="@pEndDate" value="null "> </params>'

    EXECUTE SP_CLR_Export_Excel 'dbo.DetailRaport', @path, @file, @params;

    GO

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/