Accessing data on External DB via Stored Procedure?
Last Post 01-20-2011 03:36 PM by Ryan Bakerink. 8 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Jeff SullivanUser is Offline
going with the flow
going with the flow
Posts:39
Avatar

--
10-13-2010 02:24 PM
    Hello, we've got a need to present a grid of data that is generated by a stored procedure on an external database. 

    We can't seem to get Dynamic Views to access the data. I think we've tried all the combinations of free form and regular queries, and they all seem to fail when we try to generate the columns with "The stored procedure 'dbo.DataSprings_RetrieveDynamicView' doesn't exist."

    Is it possible to pull data from a stored procedure on an external database (SQL 2005, if that matters)?
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-15-2010 09:42 AM
    Hello Jeff,

    Yes this is possible,

    you will need to include the connection string for this external database in the External Connection textbox field in the Dynamic View Module Configurations.

    If you have any questions please let me know.

    Thanks,

    Ryan
    Jeff SullivanUser is Offline
    going with the flow
    going with the flow
    Posts:39
    Avatar

    --
    10-15-2010 09:53 AM
    Ryan,

    I definitely have the connection string in there.  I can see a table in the remote DB but can't execute a sproc.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-15-2010 09:58 AM
    Hello Jeff,

    This is very strange, does your database have an object qualifier?

    Maybe you can try placing this under Custom SQL Query:

    exec theNameOfYourStoredProcedure

    Does your stored procedure take in any parameters?

    Thanks,

    Ryan
    Jeff SullivanUser is Offline
    going with the flow
    going with the flow
    Posts:39
    Avatar

    --
    10-15-2010 11:36 AM
    It's not a DNN database, so I don't think it has object qualifiers.  The sproc does take parameters, which are currently being supplied explicitly, though eventually, they would be dynamic (if I can get sprocs to work).

    In the custom sql query, i have:

    EXEC MySprocName '2010-10-10', 1,1
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    10-15-2010 12:49 PM
    Hello Jeff,

    Well I find this very interesting that it's not working with stored procedures.

    Can you try creating a SQL function that performs the same actions as your stored procedures, and then call the function in Custom SQL Query?

    So just to be clear you can use tables from this external DB but you can't run stored procedures?

    What DNN version and Dynamic Views version are you running on?

    Thanks,

    Ryan
    Jeff SullivanUser is Offline
    going with the flow
    going with the flow
    Posts:39
    Avatar

    --
    12-07-2010 01:53 PM
    DNN 5.5.1, Dynamic Views 2.0.0.

    I have tried, essentially, the following:

    1) SELECT TOP 10 * FROM FOO WHERE BAR = 33

    2) EXEC spFoo 33

    3) SELECT * FROM dbo.fnFoo(33)

    #1 works, #3 works, but #2 egenerates an error: "Incorrect syntax near the keyword 'EXEC'. Incorrect syntax near ')'." Though running that exact query in the query analyzer of SSMS works fine.

    (I've tried it as EXEC and EXECUTE, and with and without a trailing semicolon with the same results.)
    Jeff SullivanUser is Offline
    going with the flow
    going with the flow
    Posts:39
    Avatar

    --
    12-07-2010 01:55 PM
    Also, I had to run the Create Procedure dbo.[DataSprings_RetrieveDynamicView] that Chad posted in another thread in my external database to get the query to run at all.  It looked like that wouldn't be necessary in future versions, but it still must be.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    01-20-2011 03:36 PM
    Hello Jeff,

    It has been recently confirmed that stored procedures can't be used in the Custom SQL Query and Actions.

    Please let me know if you have any questions.

    Thanks and sorry for the delayed response.

    -Ryan


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi