Hide items from autocomplete menu in SQL Server Management Studio - sql-server

Does anybody know how to hide specific things from this menu?
I want my columns be at number one priority, followed by functions and constants. I don't need all this system variables there.
In Visual Studio I can show those entries by category. Does a feature like this exists for the SQL Server Management Studio as well?

In the SSMS menu under Tools/Options, you can find that this option is not available:
One option is to type category. (= your table-name followed by a dot), but this defeats the use of Intellisense 😉
Slightly better would be: SELECT * FROM category c WHERE c. which should start showing the fields for this table.

Related

how to select a bunch of objects automatically in ssma(SQL Server Migration Assistant)

I'm using ssma to migrate from oracle to SQL Server with about 1000 tables.
And during the migration, about 100 tables went wrong (because of wrong type mapping) and I want to rerun only those tables.
Are there any way to select them automatically(by script or even some third-party tools) rather than click them one by one?
Answering my own question..
Turns out ssma has a built in function called "Advanced Object Selection" in the right click menu.
Advanced Object Selection
And then you can input tables(or other object names) in the "Set Selection".
Set Selection

Sync with active table Microsoft SQL Server

In Visual Studio you have a function: sync with active document. This is a very handy function. Because you can see in the solution explorer where the document has been stored.
My question is: is there a similar function in Microsoft SQL Server 2014 - that you can stand with your cursor on the table name in a query and then for example with a sub menu you can see witch table is selected in the object explorer.
This is especially handy if you have for example 300 tables and you want to see the columns of that table that you have written in a query.
THank you
I am not aware of any way to do this natively in SQL Server Management Studio. However, there are several third party extensions which do have this feature.
Two of the more popular extensions:
ApexSQL Complete (free)
SQL Prompt (paid w/free trial)
Both of these tools have functionality that allows you to navigate to an object in the Object Explorer, or view the contents of the object from within the query window by hovering the mouse over the object name.
For example, this can be accomplished in ApexSQL Complete by right-clicking an object and selecting "Navigate to object".

tfs 2010 database bug location

I am looking at a sql server database for a tfs 2010 install and I am trying to find bugs/files logged by date.
Is this information contained in the database?
I see other information such as a view named WorkItemChanges which shows all the stories that have been changed by date.
* Directly querying the collection database is unsupported *
The Tfs{YourProjectCollection} database contains all work items for a specific project collection. They live in the different Work Item tables, since a bug is a specific type of work item.
If your TFS environment is configured for reporting using Report Server, then you can use the Analysis cube or the TFSWarehouse databases to query this kind of information. For work items, a limited set of fields is stored and the same goes for files in source control. You should at least be able to find out which have changed. The following doc describes the warehouse structure: Creating, Customizing and Managing reports for Visual Studio ALM. A quick way to get started is from the Excel Powerpivot reports which are installed to your team project by default if your TFS instance is connected to a Sharepoint server with teh appropriate features enabled.
* You have a number of alternatives *
I suppose that your Visual Studio is currently working, if that's the case then there is no need to use a SQL query to get to the information you're after.
To query all bugs (or other work item types) that have changed between two dates, create a work item query (in Visual Studio) that looks like this:
You can import these into Excel for easy manipulation or further aggregation. And you can even quickly create a Report from that. More information can be found in the Bulk Add or Modify work items in Excel.
To query all files changed between a specific date range, is a little harder. You can quickly get all changesets between two dates using the commandline using tf history $/Project /collection:yourprojectcollectionUri /recursive /version"D2012-10-10~D2013-10-10" this will popup window with all changesets between these dates. You can specify /noprompt /format:detailed to dump all details to the command prompt window.
Alternatively, you can do a folder diff between two dates. This can be done from the UI in the Source Control Explorer. Or from the commandline using tf diff or tf folderdiff

Visual Studio DataSet Designer Refresh Tables

In visual studio datasource designer is there any way to refresh a table and its relations/foreign key constraints while keeping the custom queries?
The way I am doing it at the moment is removing the table and adding it again. This adds all the relations and refreshes all fields.
Also if I change a fields data type, is there a way to automatically refresh all the fields in the datasource? Again without deleting the table and adding it again.
Reason for this is because some of my TableAdapters have quite a number of complex queries attached to them and when I remove the table the adapter gets removed as well including all its queries.
I am using Visual Studio 2008 and connecting to a MySQL database.
Any1 have an idea?
Each table has a default query (The one on top with the check on it). When you dragged your tables in to the dataset to create the query, it wrote a SQL statement which it uses to schema your table. Keep that query simple, you might not actually use it in code, and you can always edit that query to update the table schema.
Every time you open the default query it connects to your datasource and allows you to select new columns that weren't in there before. If you want to update your existing columns, delete all the columns out of the table before you attempt to open the query. When you save the query, your updated columns get added back.
Make sure your connection string has permissions to view column information.
I reported this to MSFT but no response. The designer hangs all the time on the simplest of SQL statements. What I found that works for me is.
Add a new table to the designer.
Save it.
Shut down visual studio 2010.
Start VS 2010.
Add one or two more SQL statements and follow steps 2-4 again.
This is a pain in the neck but the only thing that stops Visual Studio dataset designer from hanging. I experienced in this same issue in VS 2008. I am connecting to Oracle but still shutting down VS and starting it back up works, but really, this is nonsense.
You can add/change/remove fields and relation ships, but i would suggest looking into NHibernate.
You should be able to right-click the dataset in solution explorer and select "Run Custom Tool" to refresh the table and it's query/relationships.
If that command is not there, check that the dataset properties has "MSDataSetGenerator" in the Custom Tool field.
Right click on your DataSet name and select Dataset Properties
Below the Query box you will see a button for Refresh Fields.
Click on Query Designer and the new field should show in your table list.

Is SQL Server Management Studio as bad as it seems? How to view relatiosnip attributes?

So, I'm using SQL Server Management Studio Express,it has been working not bad so far, ignoring some of the weirdness.
But I just happened to get a whole shwack of data deleted when I happened to delete a row in a parent table. So I thought I must have cascade deletes enabled in this relationship. But, how does one determine this?? If you double click a relationship in the DB Diagram, your only option is Delete, and the tooltip only shows you the FK relationship name.
This fellow had the same problem as me:
http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/1f9c1e8f-b719-476d-828e-91ac6722096a/
So, am I missing something, or is this another situation where a software company deliberately does a half assed job? I have an MSDN ultra (or whatever the highest level is) license, so will that be better, or, is there a 3rd party tool one can use??
In SQL Server Management Studio Express, don't you have the option to 'design' the table. (Right click on the table, then design) ?
Then, you should have an additional toolbar with an icon which looks like 3 tables and their relationships. The tooltip of that button says 'Relationships'.
When you click that button, you'll see the foreign key constraints of that table, and in the dialog box, you can specify the UPDATE & DELETE rules of the FK.
The diagram tool isn't great.
If you use the Object Explorer to open the Tables, open the table you're interested in, open Keys, you should be able to find your foreign key, right click on it and choose Modify (or choose to script it out (to window/file/etc)).
This works in SSMS 2008, haven't tried in 2005 Express, but I'd be surprised if it wasn't there (since it's basically functionality that was built into Query Analyser long ago)

Resources