Reverse engineer a SQL query/views

  • When on BI dev assignment I often have to create views as the basis for creating a star schema. Many times I have to use named queries in the DSV.

    I wondered if there was a tool/macro for reverse engineering tables/views or a SQL query.

    I have Visio Pro 2013 on my laptop but many times at clients I'm working on their dev machine.

    Ideally I'd like to be able to export a script and import to my local visio.

    Would save lots of time during design/documentation.

    Best

    Lee

  • leejayd (2/4/2016)


    When on BI dev assignment I often have to create views as the basis for creating a start schema. Many times I have to use named queries in the DSV.

    I wondered if there was a tool/macro for reverse engineering tables/views or a SQL query.

    I have Visio Pro 2013 on my laptop but many times at clients I'm working on their dev machine.

    Ideally I'd like to be able to export a script and import to my local visio.

    Would save lots of time during design/documentation.

    Best

    Lee

    I am not sure I understand your question here? Are you trying to take a result set and convert that back into the base tables including datatypes and such? I don't think this is possible. How would you possibly know what table, or maybe a derived value, a column came from based only on the name in a resultset?

    Perhaps if you can more clearly explain what you are trying to do we can help you find a way to make it happen.

    _______________________________________________________________

    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/

  • Data source views(DSV) are stored as XML which is not that hard to get. You just need to explore a bit as I can't remember the exact tag that it's used.

    How to import it to Visio? That I have no idea as I've haven't worked with Visio since college.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • I'm trying to create a diagram/schema using a query as an input i.e. joins will be shown as links to other tables. More to aid documentation rather than anything else. We see a similar thing in Tabular with the data model view.

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

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