I would like to start learning about SQL Server projects development, I have installed Microsoft Visual Studio 2015 which includes some tools for SQL Server development. However it seems to me that some of the features found in SQL Server Express are not supported in Microsoft Visual Studio.
For example when I create a new view in Visual Studio SQL objects explorer there is no option to open a view designer, the only way I can create a view is by typing SQL instruction, i.e. there is no GUI for that purpose, although my studying materials indicate that there should be a view designer GUI.
No option to open a view in design mode, most of the buttons are grayed out
Also the commands for view, query and table design are always grayed out. Why?
Should I switch to SQL Server 2016 Express if I want to focus on learning about SQL or Microsoft Visual Studio offers the same functions and I simply can't find them?
Thank you.
For Data related work i always used MS SQL Server and if you want to study SQL Server then you should also do practice on SQL Server because somewhere i read that VS studio does not support "Script AS" kind of thing.
For you specific query for view creation there is GUI in SQL Server for VIEW creation where you can select required tables and functions to be used in your VIEW.
Related
I am attempting to compare schemas of two databases on the same server.
The two databases are named benchmarkdb and benchmarkdb_dev.
In Visual Studio 2017, I go to Tools > SQL Server > New Schema Compare...
From both drop down menus labeled "Select Source" and "Select Target" (as seen in the picture below), I want to select benchmarkdb as source and bencmarkdb_dev as target.
After clicking to select a source, the "Select Source Schema" pops up, and I clicked the "Select Connection..." button, which brought another popup. The newest popup (the one on the right in the picture below) shows both databases I am trying to compare.
However, after I choose one for either the source or the target, all pop ups close, but nothing populates the "Select Source..." or "Select Target..." drop down menus. In fact, it just goes back to looking like the first picture.
Is there a solution to this so I can compare the schemas between the databases?
Update:
I have tried this on VS 2012, 2015, and 2017. All are facing the same issue. VS software and system software are up to date. Below are some versions of software that I am using, if it is any help.
Windows 7 Enterprise SP1
VS 2012, 2015, and 2017
SQL Server 2014
.NET Framework v4.7.02053
OK, so I managed to fix it.
First off, you need to install SSDT from Microsoft pages. Just google it.
Make sure that you also have it listed in individual components when starting Installer (on Modify). Only SQL Server Database is required (I could choose from Integration Services and 3 more).
Next, you need to "Remove connection from history" in Schema Compare modal for connection selection.
I closed VS at this point, to make sure that the connection is not in history anymore.
Starting VS the next time, you should not have the problematic connection in history.
Recreate the connection (I checked "remember password") and voila. Schema compare works.
Not really sure, but in desperation I also installed "Redgate ReadyRoll Core", "Redgate SQL Prompt Core" and "Redgate SQL Search".
I don't think it matters, but if all else fails...
Edit: This worked on 2 machines and it doesn't seem to be connected to VS version.
I had the same issue, but I don't know if I had the same root cause.
My problems started after changing my database from SQL Server on a Window Server to SQL Server on a Linux Container. The schema compare would appear to accept my selection but the database field would never actually populate and I could not perform a comparison.
There were 2 things I had to do to solve the problem.
Update Visual Studio (using the standard updater within Visual Studio).
Update the SQL Server Development Tools (SSDT) add-on for Visual Studio to a preview version that supports SQL Server on Linux. That download is available here.
After both updates were in place I could select the database and execute Schema Comparisons between my project and SQL Server on Linux exactly as I had been doing for SQL Server on Windows.
If running a local database, check what version of SQL Management studio you are using
I had the same issue running Visual Studio Pro 2017 and SQL management studio v18.6 with SQL Server 2017 installed.
I tried all of the above solutions and no luck
Even going back to Visual Studio 2015 didn't work for me. What did work though was changing back to SQL Management Studio v17.9.1
No issues any more.
I may try to upgrade Visual Studio to 2017 again to see if that works now
We currently work with all versions of SQL Server from 2005 onwards. To save time I try to do everything in a single version of Management Studio. This also helps if running newer client operating systems like Windows 10 which old client tools aren't compatible with.
Specifically when trying to view the graphical SSMS interface for index properties I get the following error if connected to a SQL Server 2005 instance.
In Object Explorer:
Database > Table > Indexes > Right Click > Properties
Full error text:
TITLE: Microsoft SQL Server Management Studio
Exception has been thrown by the target of an invocation. (mscorlib)
ADDITIONAL INFORMATION:
Cannot read property IsSparse. This property is not available on SQL Server 2005. (Microsoft.SqlServer.Smo)
This also happens in SSMS 2014, but not SSMS 2012.
So my question is; can something be done to work around this issue allowing one version of management studio to be used for all versions of SQL Server from 2005 onwards?
I'm guessing now, but as it works in SSMS 2012 there must be something going on that targets an older version of mscorlib. Maybe because SSMS 2012 uses a VS2010 shell and different .Net framework?
Many thanks in advance for your time.
There is an Active feedback about that on Microsoft Connect here. Someone suggest a workaround to go into Table Design and go to menu "Indexes/Keys...". It works, but some properties are not editable that way, like Included Columns. The other options left are to use SSMS 2005-2012 or use T-SQL script, like Aaron said.
Is it possible to write a plugin or a form for SQL Server Enterprise Manager version 8? I'm doing some simple queries all the time to admin the databases. So wondering if I could write something for it.
You mean the old SQL Server 2000 Enterprise Manager?? I don't think that old clunker had any extensibility points, sorry....
SQL Server Management Studio (SQL Server 2005 and newer) is based on Visual Studio and thus does have some extensibility - but it appears to be somewhat of a black art to write such a plugin - very little information is available.
Some is here:
The Black Art of Writing a SQL Server Management Studio Add-In
Building a SQL Server Management Studio Add-In
Extend Functionality in SQL Server 2005 Management Studio with Add-ins
SSMS Scripter - Internals, part 2 - plugging in
Since I usually do all my work in a query window, I just use a bunch of custom written stored procedures that I made, passing in parameters as necessary. all of my redundant work is done this way.
I'm currently using MSSQL Server 2000 and to design tables, create and alter stored procedures as well as manage users and permissions I'm using Query Analyzer and Enterprise Manager. I also spend an awful lot of time in Visual Studio 2008 and rather jump out to other applications I was wondering if Visual Studio could help me do at least some of the things that Query Analyzer and Enterprise Manager let me do. And if so, what specifically?
Mainly I'm looking to:
Check the database schema
Edit stored procedures (with Intellisense available)
Change object permissions
Look at the Server Explorer in Visual Studio. Server Explorer allows you to create/modify/drop/whatever procedures, tables, views, etc, though I can't see any way to modify security settings (users, roles, etc) through the UI. I recommend SQL Management Studio before using the integrated Server Explorer.
I've also just noticed a feature in the context menu for a data connection in Server Explorer called "allow sql/clr debugging." Haven't tried that but sounds like it may allow breakpoints, etc in SQL code. How cool would that be?
Edit: It seems that the Server Explorer may only be available in Pro or better versions of Visual Studio - ie, not in Express editions. Yet another reason to get the full version.
Can you install SQL Server Management Studio? This is far more useful than VS, I think.
I don't like the VS interface and it's not good for query plans, results and tuning. However, some folk I work with appear happy with VS but mostly the c# guys. The SQL heads use SQL tools.
I have installed:
Visual C# 2008 Express
Visual Web Developer 2008 Express
Visual Studio 2008
SQL Server 2008 Express
SQL Server Management Studio
In Visual C# 2008 Express, I can "Add Item" and create a "Local Database" (.sdf file) or a "Service Based Database" (.mdf file).
Visual Studio 2008 is the same as Visual C# 2008 for applications but in Websites, the only way I can create .sdf or .mdf files is via the Database Explorer.
In Visual Web Developer 2008 Express, however, I can "Add Item" and ONLY create a "SQL Server Database" (.mdf file). Even the Database Explorer doesn't offer to create a SQL CE database.
Questions:
why the discrepency between the applications, is this normal or did something go wrong with my installations?
I never "installed SQL CE", where did it come from and how is it that I am able to create .sdf file?
How do you work with these in projects on a day to day basis, do you use Visual Studio to edit the databases or do you use SQL Server Management Studio?
I believe only Professional and above may create MSSQL CE databases.
SQL CE is installed with 2008 studio, I was surprised to see it myself and didn't see an option to exclude it.
Personally I use VS 2008 to add items to my project databases. Since it's open anyway I just use it. It provides most of the same functionality as Management Studio. If I am doing separate database work, I usually do it in Management studio.
The CE databases are pretty useless. They have a limited sub-set of types and functions. They do not support views or stored procedures. Basically they only store tables; I haven't attempted to create foreign keys in them.
There is no way to rename tables or columns. You must create a new table.
Once you create your database it must be manually added to your project.
You cannot directly create a LINQ to SQL class in VS2008 on a CE database. You need to use the command line tool sqlmetal (called from .NET console) to create the class for you.
I've had issues where the Class created for a CE database didn't work like a class built for a regular SQL database. Because of this I abandoned using a CE database all together.
It would be nice if there was a reliable way to use Linq to SQL on SQLite databases. SQLite is a great self-contained database not requiring any type of external engine.
Sorry I don't have any performance statistics for an SQL CE database.
I hope this is somewhat helpful.
Brett
Ok registered now and not sure why got a -1 vote on previous answer but will expand.
Web Developer Express 2008 Does not create or work with Sql Server CE simply because SQL Server CE is not designed to work on the Web Server.
When you load c# express or vb express. sql server express 2008 is offered to be installed. SQL CE isn't installed. if you go and add a data source the two I know will be there, Microsoft SQL Server Compact 3.5 (.NET Framework Data Provider for Microsoft SQL Server Compact 3.5)and Microsoft SQL Server Database File (SqlClient), the access client may be there also.
It should be noted with a default Express setup that if you choose to use the data provider for sql server compact it will fail even though it is an option. you would have to download sql server ce separately to create sdf databases.
Also Express versions are targeted to a different audience and doesn't have the same ui setup as the main vs sku's have. For example Web express in database setup doesn't even offer the choice to use sql server ce. while in VS it is a choice from the data menu mainly because VS supports more than just web developer.
Now you said you loaded VS 2008 (didn't say what version but doesn't matter since this affects standard and above)
The default install for vs 2008 will install Sql server ce (and as previous answer stated 3.1 was with rtm, 3.5 was with sp1). you can turn it off in advance options.
One concern I have is that you mention that you can't create a database in vs on web projects. which template are you using. You should be able to create server based database Items in add item and both local and server database objects in the data tab.
so in Summery.
on client based express skus and client based projects you should be able to create a local or server based database from add item and from the data tab.
Since sql CE is not officially supported on the Web Server. on the web skus in add Item you should only have access to create a server based database. on express since it is a dedicated sku CE isn't an option in either the data tab or the add item. on vs you can create a CE database from the Data tab. and you should have access to create a server database in add item.
sql server management studio doesn't care where the source is. so it will work with all and create the database.
I use all the options listed just depending on what or where I am at the time. as was mentioned CE on the desktop is primarily a cache database perfect for offline database support. but does have its limitations and in addition really needs better integration. once I am created or working with a database in support I primarily use management studio.
The key point in why you can't access CE from Web express is that CE is not supported on the web server.
Douglas
This is normal. The database types supported by the Visual Studio designer differ by edition. Note that any version of Visual Studio can write and use code that connects to any of those databases. It's just that the visual "wizard" tools included with the IDE that walk you through it are different for each edition.
SQL CE is the Compact Edition of sql server. It's intended for use on portable devices like smart phones or as an Access replacement for a local data store in desktop apps. It's very portable: only 2 dlls that clock in at less than 1Mb of disk space, and was probably included with at least one of your Visual Studio packages, probably all of them.
I normally do all my database work from Management Studio, but that's a personal preference.
The discrepancy is odd, but since SQL CE is a plugged-in item, it may well be that the team didn't test every possible scenario and some of the applications simply didn't get the info they needed to know that it's there. I'm not saying that anything went wrong - it may simply be a scenario that the SQL CE team never tested.
SQL CE was installed with Studio (can't recall offhand, but I think 3.1 shipped with the RTM and 3.5 shipped with SP1).
I always use Management Studio for making database modifications (except those done directly in code).