Hi I have an MDB file and it consist of VIEWS. I am using "MDB Viewer Plus" to explore the tables and Views. But I can see only records from the view but I do not see the SQL script used in the VIEW.
Kindly guide. How to see the script? Hope this is valid question. I have did enough try.
Solved
I used Microsoft Access and now I can see the View.
As you mention in the update to your question, the most straightforward way to view the SQL statement for a saved query (View) in an Access database (.mdb or .accdb file) is to open it in Access, open the query in Design View, and then switch to SQL View:
Related
I am updating a MS Access away from access. There are some Append Queries that the design view will not come up at all. I read somewhere that if the append is extra old you just need to save the DB as an older version. However, that also fails to do anything.
I am using O365 Access with a 2007-2016 file format DB. It has been upgraded multiple times over the years I would assume it might've started as a 2000 DB.
What can I do to see the design of the append?
If you open the Visual Basic IDE (Alt+F11), and then open the Immediate Window (Ctrl+G), you should then be able to enter the following expression on a new line in the Immediate Window (changing Query1 to the name of your query) and press Enter to view the SQL associated with the query:
?CurrentDb.QueryDefs("Query1").SQL
You could then inspect the tables/queries referenced in the SQL and see if anything is amiss, or copy the SQL to a new query to see if it exhibits the same behaviour.
I have an Access database with a few tables and several queries. I already have this working perfectly in Access but my boss wants me to replicate the results using excel 2010. I have tried using the MS query inbuilt into excel but I can’t get the SQL query to do the same thing, I have asked several experienced people but they also didn’t know. I have decided to try a different approach.
The users need to regularly update the information in the tables and then re-run the queries. The result is then exported to excel for further manipulation. Would it be possible for me to make the database accessible via runtime. Could I have it so that the user puts all the tables that need updating as excel spreadsheets in a certain folder and then in VBA in excel have the runtime access application update the tables, run the queries and output the results in excel? The main thing is that the users won't have the full access application.
I have had a look around but couldn’t find much on this. If not, any other ideas would be greatly welcome.
From the Access wiki:
The runtime version allows users to view, edit and delete data, along
with running queries, forms, reports, macros and VBA module code. The
runtime version does not allow users to change the design of Microsoft
Access tables, queries, forms, reports, macros or module code.
Therefore, you can send code to the Access runtime version that runs queries that update your data, and have Excel linked to the tables that result from those updates.
I'm toying with the idea of migrating an office from Access 97 to LibreOffice 5. The problem is that the people in the office use the Designer in Access for Queries. They have made it clear that they won't learn SQL and as such as the IT I have to find a solution.
The issue arises when I do direct SQL in a LibreOffice Base Query. After using raw SQL I can't get the designer to kick back in for the office workers. Access can go between the two without an issue as long as I use proper Access syntax.
Is this a limitation of LibreOffice or am I over looking an option?
I had to untick 'Run SQL Command Directly' and then select 'Switch Design View On/Off' under view.
Is it possible to get the view creation statement writing any query in sql sever 2008
Actually i want to copy the views from one database to another database
thanks
Do you have SSMS? You have the option to generate scripts for all objects in a database. You can limit it to just the views.
Right click on the node for the specific database in Object Explorer.
Select Tasks
Under Tasks, select Generate Scripts
Execute the wizard, selecting the options suited for your task.
This will generate a script for all your views, or allow you to select the specific views you're interested in.
#Sashenka's answer is correct, but this will let you script more than one view at a time.
In SSMS,
Right click the view
Select Script view as
Select CREATE To
Choose New Query Editor Window
You can then copy the script and modify it for your new Database.
Easiest way is to use SQL Compare, but you can also do this in SQL Server Management Studio in a similar fashion to what I describe in this blog post.
In short, open object explorer details, multiselect all your views, and script as Drop and Create from the context menu. You can now apply this script on your second server.
I have an application that creates an Jet database at run-time, and imports ~100k records so that I can make use of the indexing for performance reasons (1 minute versus nearly 10 when not using a Jet database).
The database is created using ADO Extensibility in Excel, and everything works just fine. However, my issue comes whenever I then open the MDB file in Access front-end, it automatically starts to "repair" the database.
The data is still fine after the "repair", however my main output query can not then be viewed in Access as it tells me it cannot represent the joins, and if I then view it in SQL the required joins are not there, and the query can no longer run. This still happens if I let it get "repaired" but do not open that query, i.e. it is the "repair" that breaks the query, not the act of trying to view it in Access. The funny thing about this is that I used the Access GUI query designer to construct the SQL as my life is too short to worry about it's crazy bracketing style, but it then later decides that it's too complex for itself??
Also, nothing else appears to be affected so I can only assume it's this one query it doesn't like.
This isn't a deal-breaker for me as my fix is to make the MDB hidden and advise users who can see it not to open it.
However, I would really like it if the database could be opened and I didn't have to hide it away like that. Therefore, my question is whether there is any way to prevent the MDB being "repaired" automatically?
Thanks!
Microsoft Access is "repairing" the file when opened because it is missing some tables that are specific to the Microsoft Access user interface. Since you created the MDB file directly using OLEDB with Microsoft.ACE.OLEDB.12.0, these tables are not present, and must be created when Access opens the MDB the first time. There are several ways you can circumvent this:
1) Name the MDB something other than .mdb - e.g.: MyAccessDatabase.mad - this will prevent Windows from using Microsoft Access to open the file.
2) Use COM+ to open an instance of Microsoft Access, and have it create the .MDB file. This .MDB file will then have all the necessary tables present and will not need to repair the file.
FYI, whenever Microsoft Access opens an MDB that needs repairing in this fashion, it will inspect all the QueryDef objects for invalid SQL and correct them as necessary. This is why your "complex" query is breaking.