aleczandru
aleczandru

Reputation: 5449

Connecting an SQL Project to a database

Hi I am going threw an SQL-SERVER - TSQL video tutorial from pluralsight and I seem to have some problems.

I am using Visual Studio 2012 and SSMS 2012.

I have created a new SQL Server Database Project , and inside this project I have defined this method:

public partial class UserDefinedFunctions
{
    [Microsoft.SqlServer.Server.SqlFunction]
    public static SqlString InToMilimiter(float inches)
    {
        return 25.4f * inches;
    }
}

Now I would like to test this function on the a database that is stored in localhost.I have already connected SSMS to localhost and have access to the SportsStore database.

In the video tutorial it the other said I have to deploy the solution.I have tryed that several times but it does not seem to work.

I think this is because I have not connected my projet to the database and I do not know how.

In the video tutorial when the author selected new project and a list of databases were presented to him to choose from.

I did not have that choice so I believe that this is the problem.

Ho can I connect my SQL Project to my database?

Upvotes: 3

Views: 1704

Answers (2)

m4ttsson
m4ttsson

Reputation: 203

As you said you have probably not connected the project and the database. To do this you could either right click on the project and choose import -> database. Or you could go to Tools menu and choose connect to database.

Upvotes: 2

Obama
Obama

Reputation: 2612

Here is a candordeveloper.com article in order to create a SQL Server Database Project in Visual Studio 2012 Step by Step !

http://candordeveloper.com/2013/01/08/creating-a-sql-server-database-project-in-visual-studio-2012/

Hope this helps!

Upvotes: 3

Related Questions