Can not modify stored procedure on Azure - sql-server

I'm new to Azure SQL database.
I managed to migrate my database to the cloud.
Now I'm trying to modify a stored procedure using Microsoft SQL Server Management Studio (the latest edition - 2014). But get the following error message:
USE statement is not supported to switch between databases. Use a new
connection to connect to a different database.
Any idea how can I do this?
Also, is there any alternatives to Microsoft SQL Server Management Studio to work with Azure SQL Database?

USE in sql is used to switch between databases not to modify stored procedures. You cannot use USE on Azure SQL as per the specification. You should be able to right-click on the database name in Microsoft SQL Server Management Studio (SSMS) and select New Query, or you can use the dropdown list in the menu to switch databases. You can then use ALTER PROCEDURE (https://msdn.microsoft.com/en-GB/library/ms189762.aspx) to alter your procedure.
You can use Visual Studio as an alternative to SSMS but IMHO Visual Studio is not as productive. It doesnt matter which client you use though, because USE wont work in any of them.

Related

Visual Studio Community: how to view data or run SQL in the "SQL Server Object Explorer"

You can "explore" the schema etc. using the SQL Server Object Explorer in VS.
However, I can't find a way to view the data in a given table (at least the first page), or to run some arbitrary SQL.
Is this possible?
I also have the full blown Microsoft SQL Server Manager installed, but this can't "see" the databases created by Visual Studio in its built-in SQL Server Express instance. It can only connect to its own full blown SQL Server databases.
I have looked for a tool to view data in SQL Server Express, but have not found anything yet. There does not seem to be a version of Microsoft SQL Server Manager for SQL Server Express unfortunately.
You can do a "New Query" on any database node to run a query window:
And then you can do a "View Data" on any table, in SQL Server Object Explorer:
But you should also be able to load any "LocalDB" instance and view it from the full-fledged SQL Server Management Studio (at least since SSMS v17, where it's a separate, free download)....

How do I create Stored Procedure in MSSQL without Management Studio?

I have a customer who is not interested in installing MSSQL Management Studio. And I need to add one Stored procedure in the Database for my application to communicate.
Is it possible to create the stored procedure in MSSQL Server without Management Studio?
FYI, I can export the .sql file for Stored procedure from my system.
Solved
Solutions based on the answers:
SQLCMD (installed with SQL Server)
Azure Data Studio
You can use...
SSDT (SQL Server Data Tools)
SQLCMD
PowerShell
You could see if your client would be willing to install Azure Data Studio (formerly SQL Operations Studio). It's a quicker install than SSMS.

Proper way to Import data from Access to SQL Server?

I'm asking for the proper way, in SQL Server's T-SQL (I think that's what it is) code or using another language, to import data from a Microsoft Access MDB Database into a new SQL Server Database.
Now, typically I would just import it in. The problem is I'm writing a .SQL script (I could use another technology if needed) to do all this leg work as this will need to be done fairly regularly. Likely at least once a week, for about 5 months in the year.
To digress a tad, I had wanted to implement a single database and distinguish separate source database using something like a DatabaseID field, but the powers that be overthrew me there.
I was previously using SQL Server Management Studio 2012 with SQL Server 2008 running the T-SQL (on a production machine) that worked fine. I've now migrated to a local SQL Server Management Studio 2012 with SQL Server 2012 (for development) and the code that used to work doesn't anymore.
This code is what used to work: SELECT * INTO [dbo].[Controls] FROM OpenDataSource('Microsoft.Jet.OLEDB.4.0', 'Data Source=C:\Show.mdb; Jet OLEDB:Database Password=BobSaget')...[Control] The password has been obfuscated for security ...
That's likely a sloppy solution. What's the ideal way?
Thanks in advance!
I would recommend using Microsoft's SQL Server Migration Assistant for Access.
SQL Server Migration Assistant (SSMA) is a free supported tool from Microsoft that simplifies database migration process from Access to SQL Server. SSMA for Access automates conversion of Microsoft Access database objects to SQL Server database objects, loads the objects into SQL Server, and then migrates data from Microsoft Access to SQL Server.
SSMA for Access v5.2 is designed to support migration from Microsoft Access 97 and higher to all editions of SQL Server 2005, SQL Server 2008, SQL Server 2008 R2, SQL Server 2012, and SQL Azure.
You can find it here.
You may need to fix the structure after the migration as it tends to over exaggerate many of the data types.
Have you checked your DCOM security on MSDAINITIALIZE?
I had this problem when moving to a local instance of SSMS 2012.
http://blogs.msdn.com/b/dataaccesstechnologies/archive/2011/09/28/troubleshooting-cannot-create-an-instance-of-ole-db-provider.aspx

SQL Server Questions

How do I rename a database in Server Explorer on Visual Studio 2008? I changed the filename using Rename on the context menu, but that just changed the filename, not the name in SQL Server (2005 Express).
Also, is there an easy-to-use management tool like PHP MyAdmin that I can use? Or is it easier to just use VS 2008 Server Explorer?
Thanks!
Find SQL Management Studio Express 2005 for all your common tasks in dealing with the database. You'll find it more fully-featured than Visual Studio, and provides the functionality you're used to from PhpMyAdmin.
To rename your database, create a new query, either in VS or SSMS:
EXEC sp_renamedb 'oldDB_Name', 'newDB_Name'

extract schema for sql server compact edition

Is there a way to generate the sql statement for tables in sql server compact ?
same as for sql server express+ ?
Essentially a create table( .... ) statement as output ?
There is a project on Codeplex that someone has actually built the functionality to be able to do scripting for sql server compact edition databases.
There is a tool to do this. Check out http://www.antipodeansoftware.com/Home/Products
This will iterate the entire SQL server, and write all the table, view, stored procedure and UDF scripts to a local drive. Great for adding SQL schema or DDL to source control.
The plugin SQLite & SQL Server Compact Toolbox has versions for Visual Studio and SQL Server Management Studio. I've used the latter version successfully to add columns and export the schema as CREATE TABLE statements from SQL Server Compact Edition 3.5.
You can connect to SQL Server Compact Edition using SQL Server Management Studio(SSMS), which in turn allows you to script out all database objects.
Please refer to: Managing SQL Server Compact Edition with SQL Server Management Studio
and then also, How to: Generate a Script

Resources