In SQL Server Management Studio if the user creates new table columns, tables, etc. the user needs to refresh the IntelliSense cache using CTRL+Shift+R.
Is there a setting or some way to automate this so it can automatically be refreshed right after inserting a new table, etc?
I don't know that there is a way to automatically refresh the cache without manually pressing Ctrl+Shift+R (or equivalent, e.g. the menu). The reason is that when the app talks to the database too much, people complain that it is too chatty (perhaps someone could write a simple add-in that does this - using something like query notifications to indicate something has changed in the metadata views?). You may also want to consider an add-on like SSMS Boost (though with a quick keyword search I see no mention of this functionality on its feature page) or SQL Prompt (but also I don't see any evidence of this functionality in their documentation, only a mention here of an experimental feature).
I believe SQL Server Data Tools does this, but I don't know if you can control the frequency of the refresh. And using that tool may also require a significant shift in how you think about database development.
Related
Next week I will create some simple select queries for PowerBI for a new customer who wants to have more insight in his business.
Until now I have only done this for our own company. I am afraid that by installing SQL Server Management Studio and building some queries in Management Studio I might (in a freak accident scenario) damage his database. I know this is unlikely.
However I do not really want to mess with his configuration. I also do not want to give him any ground to argument against me if anything unrelated does not work afterwards.
What would be a reasonable way to get my queries without really touching his database ? I thought of using a 3rd party frontend like Heidi SQL or FlySpeed SQL (even better because you cannot do admin tasks with it). I cannot just start with PowerBI because I need to analyze his DB first (scroll through tables etc).
Also I thought of making a backup of his DB first but that involves playing around with Management Studio.
Thanks in advance for any suggestions!
Backup and restore. Then use the backup to work as a development system that way you can work out the bugs then put your app or queries into production.
Check out SSMS ToolsPack. It wont stop you from updating/deleting some rows. But will give you a warning if you are running a update/delete without a where clause. Or if you run a TRUNCATE or DROP TABLE statement. See config for settings. Also has color coding for windows.
Also has Window connection coloring - you can color the query windows based on the server/database name
I'm working with:
VS2013 Professional, Microsoft SQL Server 2012 - 11.0.5058.0 (X64)
I have kind of a two part question. What I'm wanting to achieve is: I want to, as seamlessly as possible, to be able to work on the same project on my work PC and home PC. As of right now, I am using online hosted Subversion for source control which is working fine for application code. The part I have no control over at the moment is the database. I would like if I could get "all" database changes made at either work or home to synch to my other machine.
By database changes, I mean:
Schema Changes
Data within specific "Application" tables (I obviously
do not intend to synch data in all tables)
I followed this just to test getting a DB schema into my project and under source control:
https://msdn.microsoft.com/en-us/library/aa833194%28v=vs.100%29.aspx
It seems to work fine. However, that covers schema changes when working on one machine. If I then go home and want to:
either build from new or update changes to the schema on my home machine, or
update data in base "Application" tables
...I have no clue how to do that, or if it is even possible?
I would think there should be a simple (ha!) way for making the schema changes flow through easily?
But changes to app tables might be harder - I'm happy to write a sql script to manage that, but I'd like to be able to have that script automatically run when I do a "refresh" my local copy of the database.
For schema changes, there are good blogs out there on using SSDT/DataDude/VS DB Projects. Jamie Thomson has written quite a few times on his experiences. I've written up my experiences here: http://schottsql.blogspot.com/2013/10/all-ssdt-articles.html
For data - you can use the native "Data Compare" option under the "SQL" menu in SSDT. It's not perfect, but it can help. Overall, though, what you'd want is one of a couple of things:
1. Extract data from the shared system, write a task to populate that - batch files w/ BCP, SSIS, or some apps that can actually generate T-SQL for you.
2. Write it yourself, being sure to guard against attempts to insert duplicate data and ensuring the key values remain unchanged.
3. Buy a copy of Red-Gate's SQL Data Compare Pro. You can save the compare options and can then execute those through the command line.
If you need this for multiple developers, option 1 or 2 is probably the best way to go, though you can use SQL Data Compare to get you started with a pretty good script. You should also be able to use something like Mladen Prajdic's SSMS Tools Pack to script result sets to T-SQL inserts that you could re-use.
If you use one of those options and combine it with a post-deploy script (maybe even one that only runs if this is a "new" build), you should be off to a good start.
Can Lightswitch Be Used To Create A Web Based Real Time SQL Server Databse Monitoring Application
In otherwords if I have one or more querys I run in SQL Server Mgt Studio's Query Tool to get various pieces of information can I use Lightswitch to create an IE based version of this that will execute the same queries against the same SQL database and re-execute those on some timed value so that I effectively have a real time montioring applictaion or live report that shows the info I choose?
SQL Server Mgt Studio has a great tool called the Activity Monitor that on a fixed interval (a value that can be changed by the user) to rquery a number of system views and other code so as to provide the user with a monitoring like interface that is effetcively a live report. Its live because it continually re-querys the data source without the user having to do anything.
For a long time I've been using pre-defined queries in SSMS's query tool to continually check on data I've defined (as opposed as to system views created by someone at Microsoft) and I would love a way to do this without having to use SSMS and in a way so that it auto executes the queries on a specific interval so I don't have to continually press F5.
If there is another solution aside from LIghtswitch thaat can do this that doesn;t cost and arm and a leg I'd love to hear about it.
Thanks
You would need to attach the database to Lightswitch and recreate the queries there. Then create a screen to display the relevant data. But yes, Lightswitch can do what you want. You just need to implement a timer to refresh the screen on the interval you define. I do something similar in my Lightswitch app. I followed this guide:
http://lightswitchspecial.blogspot.in/2012/02/autorefresh-lightswitch-screen.html
I'm working with WinForms a project that has a couple of oddball requirements. This is an existing business system that is installed in numerous locations under a fairly wide variety of environments. Part of this variety is a mixture of SQL Server versions, and--of particular importance--SQL Server Reporting Services versions. Everyone is on at least 2005, but about 50% of our users are on some flavor of 2008.
Unfortunately for me, I need to be able to run a client-side report that's written in 2008-version RDL. I can't modify the report in any substantive way at this point, so rewriting it in 2005-version RDL isn't an option. The catch is that this report (as it's written in 2008) requires the 2008 ReportViewer control. However, the 2008 ReportViewer control cannot connect to 2005 SSRS.
The solution that I've come up with is more than a little hacky, but it will alleviate 90% of the problems introduced. I've left the references pointing to the 2005 version of ReportViewer, and I'm modifying the application configuration on startup to add assembly binding redirection tags moving from version 9.0.0.0 to 10.0.0.0 for ReportViewer.Common and ReportViewer.WinForms if the user's target report server is running 2008.
As twitch-inducing as this solution is, it's working for me. The users running SSRS 2005 can still access their existing reports, just not the new one. The users running SSRS 2008 can access everything. My only problem is that I haven't been able to find a way to refresh the configuration data. I'm updating this info before any of the assemblies are loaded, but calling ConfigurationManager.RefreshSection("runtime") doesn't appear to have any effect. Once the app restarts, the proper assemblies are loaded, but I'd really like to be able to have this change take effect immediately.
Any thoughts on how I can force the runtime to reload the binding redirection information from the App.config file at runtime?
Once the AppDomain is created, the configuration data that affects binding is fixed. Which happens on the default CLR when the primary AD is created, before your code starts running. If you are really desperate then you could create a secondary AppDomain and give it a custom AppDomainSetup with another ConfigurationFile. And loads and run your regular startup code in that AD. Not exactly sure what kind of side effects this might have.
I've been searching for some time for a good solution to implement the idea of managing schema on an SQL Server Compact 3.5 database.
I know of several ways of managing schema on SQL Server Express, SQL Server Standard, SQL Server Enterprise, but the Compact Edition doesn't support the necessary tools required to use the same methodology.
Any suggestions/tips?
I should expand this to say that it is for 100+ clients with wrapperware software. As the system changes, I need to publish update scripts alongside the new binaries to the client. I was looking for a decent method by which to publish this without having to just hand the client a script file and say "Run this in SSMSE". Most clients are not capable of doing such a beast.
A buddy of mine disclosed a partial script on how to handle the SQL Server piece of my task, but never worked on Compact Edition. It looks like I'll be on my own for this.
What I think that I've decided to do, and it's going to need a "geek week" to accomplish, is to write some sort of a tool much like how WiX and NAnt works, so that I can just write an overzealous XML document to handle the work.
If I think that it is worthwhile, I'll publish it on CodePlex and/or The Code Project because I've used both sites a bit to gain better understanding of concepts for jobs I've done in the past, and I think it is probably worthwhile to give back a little.
Edit on 5/3/2010:
If someone is willing to "name" the project, I'll upload the dirty/nasty version that I've written for MS SQL to CodePlex so that maybe we can start hacking out a version of SQL Compact. Although, I think with the next revision of the initial application that I was planning, I'm going to be abandoning SQL Compact and just use XML Files for storage, as the software is being converted from an Installable package to being a Silverlight application. Silverlight just gives a better access strategy.
I am currently looking into Migrator.Net.
This allows you to write changes to your database, called migrations, directly in C#.
These migrations can contain everything from simple table additions/drops, column modifications, to complicated data update code.
When your application boots, it can verify what version the database is currently in and apply any migrations that are required to bring it up to date. All this is handled automatically. The code to run this update is as simple as:
Assembly asm = Assembly.Load("LocalModels.migration");
Migrator m = new Migrator("SqlServerCe", "Data Source=LocalModels.sdf", asm, false);
m.MigrateToLastVersion();
I am having a couple minor issues with the Compact support (it assumes the default schema is dbo). But I don't think it will be too difficult to fix them.
some random thoughts (not sure I can fully answer though)
the Microsoft Sync Framework is one option. I haven't had a chance to fully appreciate what it can do once you've deployed it after the initial first time (which seems to work fine). There's a MSDN site for it here
You can execute scripts on a mobile device, but not through something like SQL Management Studio, so in theory you could manage/maintain T-SQL scripts but the down side is that the T-SQL would be convoluted (to CE's supported statements) and I don't know a way to "automate" execution - but the Sync Framework might hold some answers..
If one of your key criteria is going to be working efficiently over a small pipe, the only real choice you have is to store a DB Schema Version (maybe somehow tied to the scripts checked into your CMS) and when an update is needed, the change scripts are sent over the wire and applied in order. You would probably want to keep a log in your DB as well of these scripts being applied so you can gracefully handle disconnects, reboots and other potentially nasty problems.
Is SQL Server Management Studio any use for you?
http://technet.microsoft.com/en-us/library/ms172933.aspx