Sync with active table Microsoft SQL Server - 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".

Related

Migrate data from Sql Database to SharePoint list and libraries

Need to migrate data from Sql tables to SharePoint 2013 lists. The database size is approximately 80 GB and need to move the contents from Sql tables to SharePoint lists with same schema.
Just want to know if there is any tool available for this. Or do we need to create an application (probably in .net) to fetch data from Sql and write back to SharePoint lists.
Any suggestions.
Try to see this article:
How to: Create an External Content Type Based on a SQL Server Table
In addition, see CodePlex, if you will use SSIS to perform the exportSharePoint List Source and Destination in the Microsoft SQL Server Community Samples: Integration Services project on CodePlex.
Using current toolchain you may consider using this path:
Open Excel
Add a data connection to your SQL Server
Import all data you want to have as a SharePoint list - you got a sheet now
Save as *.xlsx file
Go to SharePoint 365, select "New List"
Choose "Import from Excel" in the "New" dialog
There appears a sheet preview where you can adjust column types (most likely needed)
Click "Next", give the list a name (you may need to remove the silly Guid attached to the generated name, apart from this the name is the table name)
Click "Create"
Done
For a single table with roughly 800 records it takes 2 mins approx.

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

Create Database Instance from Model

*Seems like there is some confusion. I created a SQL Server Compact Edition file and can see it from the Server Explorer. I can also right click and add tables manually. What I want to do is run the generated sqlce file to add all of the tables and columns from my model to the SDF.
-- background --
In Visual Studio 2012 (Ultimate), I designed a model using the model designer. It created an edmx file. I right clicked the model and chose "Generate Database from Model..." and created an sqlce file. My understanding is that I should be able to execute this file on an sdf somehow to create a SQL Server Compact Edition Instance of my database. I don't see the option on right click to execute the sql code, and the other option is to "Run SQL Scripts in Solution Explorer" which doesn't seem to make sense.
http://msdn.microsoft.com/en-us/library/yea4bc1b.aspx It says to drag the sqlce file to a database reference, but I'm not really sure what they mean. I have tried to drag it to the server explorer where the sdf is connected.
I tried right clicking on the sdf in the Server Explorer to do New SQL Query and pasting the sqlce in, but it seems that Create Table isn't supported.
Any ideas?
Generate Database from Model... only generates tables and relationships.
You need to have a database created already, and have it in the Database References folder. Then you drag your script file to that database reference, as described in your mentioned link.

How to edit SSMS Script Table As templates?

In the context menu of a table in SQL Server Management Studio there are several items under the common item Script Table as:
SELECT to
INSERT to
UPDATE to
DELETE to
..
and the same for all objects, e.g. stored procedures, functions, etc.
How can I edit the templates used by that menus?
You cannot edit the templates used by SQL Server Management Studio (which would be a nice feature).
You can create your own (parameterised templates) in C:\Users\Username\AppData\Roaming\Microsoft\Microsoft SQL Server\100\Tools\Shell\Templates\Sql (for SQL Server 2008)
What do you want to do with this?
Have you seen the SSMS tools pack which adds some right click options?

SQL Server Mangement Studio Alter Script (2005)

Is it possible to generated ALTER sql script from the changes you perform in Server Studio. This is possible in different tools for mysql, basically you get the log of executed statements. Is similar thing possible here, or how do you go about finding out what the modification (ALTER) script is?
Thanks.
-- MB
You will be able to auto generate change scripts in SSMS. Take a look at this article, I believe it might be what you are looking for. http://www.mssqltips.com/tip.asp?tip=1723
from the article
As a part of my best practices, I always save the T-SQL scripts used for creation and modification of objects in SQL Server. When creating and modifying tables using SQL Server Management Studio designer it is easy to right click in the designer and select "Generate Change Script...", but is there a way to automatically script the creation and/or modification of tables made through of SQL Server Management Studio (SSMS) designer? This tip shows you an option that exists within SSMS to automatically generate these scripts for all table changes when using the table designer.
If you're altering a table (by right-clicking and selecting Design, then there is a button named Generate Change Script on the Table Designer toolbar.
If you're talking about changes made in a properties window, there is a script button at the top of each of those that can generate scripts for changes you make through the UI.
Not sure about SQL Server 2005, but in SQL Server Management Studio 2008 and later, you can definitely do this.
When you modify a table in the table designer (right-click on a table in your Object Explorer and pick "Design" from the menu), you can have SSMS generate the ALTER script for you by right-clicking in the designer and choosing "Generate Change Script":

Resources