can i view aspnet.db in sql server 2008 management studio - sql-server

i have just started playing aorund with asp.net mvc and i want to view the database (aspnetdb.mdf) in sql server 2008 management studio
but it doesn't seem to let me view this file.
any suggestions?

You have to attach the database to the SQL Server instance using CREATE DATABASE FOR ATTACH or sp_attach_db, and then connect to the instance with SQL Server Management Studio to view the contents of the database. I am assuming that you are using SQL Express, which would mean that your application is configured to use User Instances where the connection string attaches the database to the SQL Server during code execution. This isn't a optimal way of doing things performance wise since you have to pay the cost to bring the database online repeatedly. If you attach the database permanently to the SQL Instance you will need to change the application connection string because the database can only be attached once since SQL Server takes an lock on the file to prevent it from being changed by another process.

Related

Azure Data Studio Not Showing SQL Pool Tables

I'm trying to access data on a SQL Server with Azure Data Studio. When connecting to the server it shows a SQL Database and a SQL Pool under Databases. I can see and interact with the Tables of the SQL Database but not with the SQL Pool.
When I use the same connection in SQL Server Management Studio all tables are visible for the SQL Pool.
Any idea what I might be doing wrong in Azure Data Studio?
It works now.
It seems one has to be careful in which order to resume the SQL Pool (this one is paused most of the time) and connect to the SQL Server.
So first resuming the SQL Pool and then connecting to the server seems to have done it.

Creating Database in Visual Studio 2015

I am trying to create a database in Visual Studio 2015 MVC setup. When I create a new file in the "App_Data" folder and select SQL Server Database, a popup comes up that says the following:
"Connections to SQL Server database files (.mdf) require LocalDB or
SQL Server Express to be installed and running on the local computer.
You may need to modify the setup and ensure Microsoft SQL Server Data
Tools is selected."
I have already installed SQL Express in my computer. But Visual Studio still shows the same popup. Can anyone please give me a step by step instruction on how to create a DB through Visual Studio 2015?
(My thought was if I clicked on new file->SQL server Database, then a popup would launch allowing me to input my data and name it. But I obviously am unable to do that).
Make sure that SQL Server is up and running. Open up SQL Server Management Studios (installed with SQL Server) and try and connect to the instance that you created (should be the same as your machine name). If it fails to connect, SQL Server might not be running.
To turn it on, open SQL Server Configuration Manager (just do a search and it'll show up), go to SQL Server Services, and turn on the database engine. You should then be able to connect to the database.

Syncing a SQL Server CE database with a regular SQL Server database

There's an Umbraco site that various people been contributing content to. It runs on a hosted domain using a SQL Server Compact edition database for the CMS. It's about to go live and I need to sync the dev database to the live SQL Server instance which is hosted by a third party.
I just ass(u)me(d) that I could attach the .sdf to my local SQL Server and use a commercial tool (Redgate/SQLDelta etc.) to copy it to the live db. This does not seem to be possible. While I have managed to attach the .sdf using Linqpad, I can't connect to it like a regular database.
The best option seems to be to script out the entire database, but this seems like an impossible task using just Linqpad (no flies on Linqpad, obviously - it isn't the tool for such a task). Any less onerous options would be gratefully accepted.
You can use my free "SQL Server Compact Toolbox" Visual Studio extension for this. It can generate a script of the entire SQL Server Compact database, that you can then run against an empty SQL Server database.
In the past I did this kind of scenario wherein I need to copy the data from the SQL Server CE to a SQL Server database. Have you tried adding the .sdf to an ODBC then linked that ODBC to SQL Server?

How to view an mdf file Visual Studio 2012 creates to store ASP.Net MVC 4 project data?

I've created a new ASP.Net MVC 4 project in Visual Studio 2012 and figured out that it creates a file with a .mdf extension to store the data.
I would like to view the database schema and be able to query it manually the way I can query a SQL Server database with SQL Server Management Studio.
How to do that?
.mdf IS SQL Server ... just attach the .mdf to your SQL Server instance, and you can have a look at it using SQL Server Mgmt Studio.
This whole AttachDbFileName= features is crap - sorry. I would never use such an approach to fiddle around with .mdf files. Just attach the .mdf file to your SQL Server instance, and then the database will be on the server (where it belongs) and you can see it there (and use it from there - update your connection string to connect to the server and the database on the server).

Automatic update of the Database Engine (SQL Server) in a web-application context

I'm working on a web application using Spring 3.0 and hibernate 3 with SQL Server 2008.
A specific work flow requires to check some data in the database periodically (each 1st of a month for example) and do some process (update some tables).
My question is, do I need to put a script on the server that will check continually the database? Or can I do this with SQL Server?
See:
How to: Create a Job (SQL Server Management Studio), specifically,
How to: Create a Transact-SQL Job Step (SQL Server Management Studio)
and
How to: Schedule a Job (SQL Server Management Studio)
The easiest and most flexible way will be to have an external script that runs at the desired times and does the updates.

Resources