Create database for SQL Server - sql-server

At work, I'm able to connect to several SQL Server databases which I can write code to query from. I would like to be able to have my own database on my own computer at home so that I can practice writing queries.
So according to https://msdn.microsoft.com/en-us/library/ms186312.aspx, the steps that I should follow is:
Using SQL Server Management Studio
To create a database
In Object Explorer, connect to an instance of the SQL Server Database Engine and then expand that instance.
Right-click Databases, and then click New Database.
So I'm kind of stuck on step one because I don't have any database / servers/ instances (I may be using the wrong terminology here). How do I get one? I would really appreciate it if someone can give me a high leveled overview of how everything is related.

1) Instal SQL server to your local PC, some help you can find here https://learn.microsoft.com/en-us/sql/database-engine/install-windows/install-sql-server-from-the-installation-wizard-setup
2) Connect to your SQL server
3) Clicl "New Query" and exec
create database test
This stmt will create DB with name "test" and default properties

Related

Microsoft Visio Database add-in - Reverse Engineer of Azure Sql Server only showing 'master' Database and no others

I'm attempting to use the Visio Reverse Engineer wizard, part of the database add-in for Visio, targeting one of our databases that's an Azure SQL Database.
I'm able to successfully connect using the same connection strings that I use for all of our other services, SSMS, SSIS, Python, etc..., however the only DB option it gives me is 'master' Master DB only Option. One connected it displays only objects in the master db which obviously I'm not trying to reverse engineer into a data model. Master DB objects available
Additionally, I've tried passing 'Catalog=' Parameter to point to the database in question but this gives me the same options.
All of our Azure SQL Databases have the connection string <databasename>.database.windows.net
I've used the Reverse Engineer wizard before for our other SQL Server (which is on an Azure VM and not a Azure SQL Database itself) with no problems.
At this point, I'm not sure if this is an issue with the Visio Reverse Engineer wizard or if there is some setting that we are missing with our Azure SQL Databases.
Any help is greatly appreciated.
Thanks!
When choosing what Visio DB Driver I wanted to use, I figured I'd try to use SQL Server Native Client 11.0 and it allowed me to select the DB I wanted to Reverse Engineer instead of just master db. Driver Selection
I'm not certain why this worked for me, bit it did.

Oracle database via Splunk DB Connect in SQL Explorer - "Catalog" is greyed out

This is the first time I'm using Splunk DB Connect for an Oracle database.
I've configured my database successfully and deployed the updated DB Connect app.
But when I try to access my connection in SQL Explorer I can't choose "Catalog" and it's greyed out. I can't get any info from the Oracle connection.
I've run into this, too. As I understand it, Oracle does not have the concept of a catalog like other SQL databases do.
Do check a few things. Make sure your database is running Oracle 11g or later. Your account may need to have dictionary access.

Azure Linked Server:

I understand that there are a few threads existing on this area, around a local server using Azure MSSQL as a linked DB.
My specific issue is the linked server appears, connects and I can view the databases but when trying to go deeper, as in see the tables I get the following error:
Reference to the database and/or server name in
'databasetable.sys.sp_tables_rowset2' is not supported in this version
of SQL Server. (Microsoft SQL Error, Error 40515).
I have tried any of the suggestions already mentioned via the other threads, and to no avail can I get any deeper than listing the databases on the Azure server from my local installation of SQL Server.
I experience the same issue when trying to do anything more than simple Select/Insert/update/delete/create Table/Drop table on my SQL Azure databases. It appears you cant do anything that touches the settings of SQL Server or any stored procs that touch system tables, perhaps because the SQL servers could be shared between multiple customers.
There are also documented areas where Azure SQL has limitations versus a local SQL Server.
We now have this capability using elastic database query, you need to follow two simple steps mentioned as:
Step-1: Create reference to external database
Step-2: Then create remote table reference in the target database
then you can execute remote queries just the way you do it with SQL Server.
Please refer for step by step details https://azure.microsoft.com/en-us/documentation/articles/sql-database-elastic-query-getting-started-vertical/

Browsing an Entity Framework code-first database + Azure Dev Fabric

I have a database created using the code-first approach against SQL Server Express. I'm trying to view the database in Management Studio, but cannot find the database. VS Database Explorer also cannot seem to find it.
I've searched about but cannot find any reference to what I'm after. Is it possible to browse a database running in the dev fabric?
Usually if we create a new database in Visual Studio, it will give us a database file, but it won’t register the database in SQL Server Management Studio. So please manually attach the database file to SQL Server Management Studio. First please find the database file, normally it is under the AppData folder of our project. Then I would like to suggest you to check http://msdn.microsoft.com/en-us/library/ms190209.aspx for instructions on how to attach the database.
Best Regards,
Ming Xu.
Take a look at Scott Gu's blog post on EF Code First and DB Generation: http://weblogs.asp.net/scottgu/archive/2010/07/16/code-first-development-with-entity-framework-4.aspx
The Azure Dev Fabric has nothing to do with the DB layer, the connection string handles all this for you i.e. when you deploy to SQL Azure your DB will go there, the only thing that needs changed is the connection string...from localhost (Dev Machine) to SQL Azure connectionn string
HTH

Connect Access 2007 to SQL Server 2008 Database

I've seen numerous answers to similar questions like this one. I haven't seen on the web many people have asked the seemingly simple question "How do I connect Access 2007 to an SQL server 2008 database" - but all of the answers describe how you can migrate from access 2007 to an sql server 2008 database, or they describe how to connect access 2007 to an sql server 2005 database. I can't find any simple solution to my problem (and probably this is a problem for many others). Here is the question (sorry for the over emphasis):
How do I connect to an sql server 2008 database (and I mean 2008, not 2005 :) ) from access 2007? Apologies again for the over emphasis, but this very simple question, and what I thought should be a very simple task seems, yes, ... impossible!
I tried running sql server browser, enabling pipes, TCP etc, but it seems that with 2008 SQLEXPRESS just isn't recognised! Please can someone help with this.
Peter
Guys - you really should check whether this works before firing off random answers. It takes all of about a minute to run up an Access project and discover that it doesn't actually connect to SQL 2008 easily.
There are plenty of reasons to use projects instead of ODBC, but here's a few:
Existence of DSN on deployment machines cannot be guaranteed
Network traffic - does not do pass-through queries by default
Poor support for stored procedures
Assuming that appropriate protocols have been enabled, the solution is to go to the Advanced tab of the data link dialog and delete the value in the Network Library setting.
There should be no issue with connecting Access 2007 to a SQL Server 2008 database.
You need to make sure that:
Your SQL Server 2008 database is accessible, ie that it isn't locked down and that it is accessible to the machine(s) where you will have your Access 2007 application.
A few things to check:
In SQL Server 2008, go to Properties > Connections > Check "Allow remote connections to this server".
Enable TCP/IP in the Configuration Manager.
Make sure the firewall allows incoming connections on TCP port 1433.
You can also start the SQL Server Browser Service so your SQL Server instance can be found.
You have created an ODBC DSN (a System DSN) using Windows ODBC administration tool. If you're running on a 64 bit system, make sure that you're using the 32 bit version of ODBC to create your DSN, otherwise it will never be visible to Access which is a 32 bits application.
Once you have created the ODBC link (and tested it works) on the machine where Access is installed, you can just link the tables: In Access 2007, in the External Data ribbon tab > import > More > ODBC Database.
Then select the DSN you create for your SQL Server 2008 database and chose which tables you want to link.
Ray,
The reason you are not seeing your database is because of permissions. You need to grant the user name you are using access to your database.
In MS SQL Server Management Studio expand the database you created and go to the security tab to configure the user name you are using. Either add it or create a new user
Hope this will help....
When going through the link or import wizard in Access choose Sql Native Client 10.0. When asked which server you wanrt to connect to, the server will not show in the combo box. If you type the correct name of the server and hit next, you will go to the authentication screen. Use windows authentication if that's what you choose and hit next. On the next screen, check the Change default database box and your server databases should appear; then you know that you have a good connection. Remember you have to type the correct server name, which should be MACHINE NAME\SERVER INSTANCE NAME.
One solution (though this may not apply to SQL Express) is to use an Access Data Project, although in 2007 it's not that intuitive how to do this.
Create a new (blank) DB, but rather than accept the default .accdb extension, change it to .adp. You can also select Access Data Project (.adp) format if you use the browse dialog to set the file location.
Once created, you will be asked if you want to link to an SQL DB... the rest is pretty intuitive, but ask for further details if you need to.
SQL Express 2008 + Access 2007 both on a workstation.
Connect to Adventureworks SQL db from Access 2007.
Here we go...
Open Access 2007
click on the windows or top left icon/ new/ click on blank database/ put in file name/
click on the browse icon/ save as type/ Microsoft Office Access Projects (*.adp)/ click OK/
click Create/ on the question do you want to connect to an existing SQL server database?
click Yes/ you can use the dropdown box to select your computer but put in it like this... (eg if your computer name is "laptop") put in... laptop/SQLEXPRESS
Click on user windows NT integrated security/ hit the down arrow on step 3. Select the database on the server: and it should show the adventureworks database. click test if you like or just OK.
Just had the same problem but found a link that suggested referring to the server in the Data Link Properites Dialog as .\SQLEXPRESS - It would seem the [.] before the instance name made all the difference.
That did the trick for me - I got connected but then access complained that the version combo - Access 2007 & SQL 2008 did not support managing DB objects form Access.
Message was as follows:
This version of Microsoft Access does not support design changes with the version of Microsoft SQL Server to which your Access project is connected. See the Microsoft Office Update Web site for the latest information and downloads. Your design changes will not be saved.

Resources