How to use Database Dynamically

  • Hi gurus,

    I have stored procedure which have one parameter for database name has to be used. i dont know how i use database dynamicall

    for example

    NORMALLY WE PUT

    USE ORDERS

    I WANT LIKE THIS

    USE @DATABASENAME

    ANY HELP IS HIGHLY APPRECIATED

    THANKS IN ADVANCE

  • If you could post more of the code, it will help.

    "Got no time for the jibba jabba!"
    -B.A. Baracus

  • SEE I HAVE EMS_SOURCE DATABASE AND EMS_DESTINATION DATABASE I AM COPYING SOME RECORDS FROM EMS_SOURCE DATABASE TO EMS_DESTINATION DATABASE WITH SOME MORE JOINTS. MY PROBLEM IS THE SOURCE AND DESTINATION DATABASE ARE NOT FIXED IT WILL VARY BY CUSTOMER. I AM CREATING APPLICATION GENERAL FOR ALL CUSTOMER

    NOW MY PROCEDURE DOING WELL. BUT ALL I DID IS I GENERATING DYNAMIC QUERY MORE SINCE I AM WORKING WITH TWO DIFFERENT USER DEFINED DATABASES. BUT DYNAMIC QUERY IS SO SLOW THAN DIRECT QUERY

    I HOPE YOU UNDERSTAND

    BYE

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply