Is there a tsql command to refresh database objects in object explorer?

  • Is there a tsql commmand to refresh UI objects in object explorer?

    I tried sp_refresh in 2008 it does not exist. Does it work in 2005?

  • No, there's no real way to link TSQL and Management Studio. Management Studio uses TSQL, it's not used by TSQL, so statements issued in TSQL won't affect SSMS. To modify what's in SSMS, you generally have to tell SSMS to refresh.

    Unless I'm completely missing the question.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • I agree with Grant. Please make use of the "Refresh" button to refresh the objects in SSMS.

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • I agree hit refresh or F5

    Scott
    I am a Senior Data Analyst/DBA
    I work with MS SQL, Oracle & several ETL Tools

    @thewolf66[/url]

  • Thanks for all your responses.

  • In SQL 2008 Object Explorer, if you right-click on almost any "node" (Databases, a particular database name, a server name, the nodes called Tables, Views, etc.) you'll get a menu. Refresh is one of the options in that menu.

  • You can try something to get the F5 pressed through script. (URL: http://ssmsaddins.codeplex.com/discussions/66360)

    private void RefreshTree()

    {

    INodeInformation[] nodes;

    int nodeCount;

    IObjectExplorerService objectExplorer = ServiceCache.GetObjectExplorer();

    objectExplorer.GetSelectedNodes(out nodeCount, out nodes);

    INodeInformation node = (nodeCount > 0 ? nodes[0] : null);

    if (node != null)

    {

    objectExplorer.SynchronizeTree(node.Parent);

    SendKeys.Send("{F5}");

    }

    }

Viewing 7 posts - 1 through 6 (of 6 total)

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