How to save a stored procedure into Azure SQL Server - stored-procedures

I am writing a test stored procedure on visual studio code (I cannot install SQL Server Management Studio or Visual Studio as I don't think its available on Linux Ubuntu).
I need to save this stored procedure on my Azure SQL Server because I am adding stored procedure activity to my pipeline in Azure Data Factory, and I have to select the store procedure while connecting to the Azure SQL Server.
Here is my Azure SQL Server where I can find the system stored procedure but I cannot find the place where I can save my stored procedure or queries to the SQL Server.

I just found out a solution. I need to be able to execute successfully the stored procedure first on my vscode. Then; after I see the stored procedure that I wrote appeared on Azure SQL server.

Related

Is there a way to check a particular stored procedure name in the TFS with MS VS?

I have this TFS server setup in the MS Visual Studio. There's a stored procedure name given, for assumption the name is MyStoredProcedure. I don't know where this stored procedure is in the TFS or who made a check-in in this. I know the branch in which I have to look for, but not sure how to find it because there are a lot of components.
Let me know if the question needs to be more understandable.
I've tried the Ctrl+F option with the stored procedure name in the "view history" tab of that branch, but was unable to find it. Maybe its not even there?
Yes you can
You can check in a single stored procedure into VSTS with VS.
Just go to the project and select the schema like dbo and go to folder stored procedure.
Add a new file, select file type as stored procedure.
After creating the file, paste your stored procedure code there, built the project and check in.

TFS2013 to TFS2017 / Single SQL Server 2012 to SQL Server 2014 AAG

My current environment is on a single vm:
TFS2013
SQL Server 2012 (dedicated instance, installed on the same vm)
1 project collection
Reporting configured
My migration target environment is:
New VM containing TFS 2017 update 1
Existing SQL Server 2014 AAG, without SSAS
Reporting not configured (because of SSAS not installed), and I actually don't need reporting
I tried multiple ways to do this installation, but encountered many problems with Always-On:
Upgrade/configure directly with database restore (through SQL Management Studio) directly in AAG, encountered TF400711 error
Upgrade/configure without Always-On, works well, but now my problem is to move my databases to AAG. Tfs_Configuration is OK, but when I attach my collection, encountering the TF246017 error. I'm not understanding this error because I use the same connection string than my Tfs_Configuration database...
What is the best procedure in my case?
I read this and this post, but they don't match to my situation.
You could use way2, since Tfs_Configuration is OK, you just need to figure out the error TFS246017. This error can occur due to following reasons
Incorrect SQL Installation order especially if you are using Express edition
Database In Recovery
Database Out-of-Sync – during migration to newer version of TFS
Permission of Service Account is not right
SQL Database not running or not reachable
TFS Proxy not reachable
Double check if you have got enough permission for the installation account. Suggest you go through the Windows Event Log , a good candidate where to look for the potential cause.
Also take a look at this thread: TF246017: Team Foundation Server could not connect to the database & this one. There are many resource about this issue in google which may help you figured it out.

How can I access SQL Server Management Studio from Visual Studio 2013, or otherwise run Stored Procs?

This link says I can connect to a SQL Server database "from either SQL Server Object Explorer or the Data Connections node in Server Explorer. SQL Server Object Explorer provides a view that is like SQL Server Management Studio."
What I need is to see and run Stored Procs in a database instance (from SQL Server Object Explorer, I can see the Tables, but not the Stored Procs).
Rather than simply "a view that is like SQL Server Management Studio" how can I get "the real thing"?
Actually, anything that will allow me to provide the necessary parameters and see the results is fine, but my "go-to tool" for querying the database (LINQPad) doesn't seem to understand Stored Procs, other than just displaying them.
So how can I access SQL Server Management Studio from Visual Studio 2013, so that I can see and execute the Stored Procs?
UPDATE
Here is what I see with SQL Server Object Explorer (no Stored Procs):
Here is what I see with LINQPad (the Stored Procs are shown, but 2-clicking one simply adds it with ellipsis dots):
SQL Server Management Studio is a stand alone program that is not accessed from Visual Studio.
SQL Server Management Studio does allow you to examine stored procedures and execute them.
After starting SQL Server Management Studio and connecting to the database with the stored procedures, expand the "Programmability" folder to see the "Stored Procedures" folder.
To execute a stored procedure, expand the "Stored Procedures" folder, right click on the stored procedure of interest and select "Execute Stored Procedure ...". (If your stored procedure requires input parameter inputs, you'll be prompted for those. Be careful doing this, I suggest doing s SELECT SP and not a DELETE.)
To see the stored procedure definition, use the "Script Stored Procedure as" - "CREATE To" - "New Query Editor Window" command.
Note, the prior images were taken from the 2008 version of SQL Server Management Studio. Your mileage may vary.
Stored Procs are available under SQL Server Object Studio's "Programmability" subfolder.
After expanding that, locating the Stored Proc, and selecting "Execute Procedure" from the context menu, you can provide values for the parameters in the "Execute Stored Procedure" dialog:
So, from Visual Studio 2013:
Select View > SQL Server Object Explorer
Select the appropriate database
Expand Programmability
Right-click the Stored Proc and select "Execute Stored Procedure"
Provide the parameters you want to test in the "Value" column
Select the "OK" button

Installing TFS on a non-system drive

I am setting up a box that will host TFS plus a number of other lightweight services. The machine has a system drive (SSD) and two RAIDed HDDs. I want to ensure that the TFS data is stored on the RAID volume for disaster recovery.
How do I make TFS use the RAIDed volume? Is it as simple as specifying SQL server to be installed on RAID? Or is there more?
TFS stores it's data in SQL Server. So wherever SQL Server hosts it's data files (MDF/LDF) is where the TFS data will be located.
Note: You don't have to "install" SQL to your data drive, you just have to make sure it's configured to place the SQL Server data files there.
If your databases have already been created you can also move the existing data files using SSMS.

How to verify the Objects in SQL Server Database and TFS are in sync?

I am using SQL Server as a database and TFS 2008 as Source and Version Control. When I create a object in database respectively I will create the object in TFS as a sql file.
I am facing problem like some developers creating object in Database but they are not updating the TFS with the same.
How do I maintain the TFS and Database in sync and if any differences are there, how can I find easily ?
I would propose to only allow developers to add and modify SQL scripts in your TFS system. Then use build automation to execute those scripts against a clean database. That way, you are always 100% sure you can reproduce your database model and content from the items you have stored in TFS.

Resources