How To Create A Solution And What Its Uses Are

The question in my mind is why should I create a Solution in SQL Server? What is its use and purpose for small and large problems in development?
  • Any Web or DB Solution is easy to develop and maintain.
  • You can think this SQL solution as your home of all your required queries.
  • You will not have to save your queries in other files like text.
  • Development is gone really fast.
  • Analysis will be crystal clear, if you have all the required queries with you. e.g. for optimization, indexing queries.
  • You can start dumping all your queries and can analyze them as well.

How to start? How to develop it?

It’s as easy as creating a new Word document and saving it.

Follow the steps given below.

Step 1

Click Start. 

SQL Server

Step 2

Select SQL Server Management Studio.

SQL Server

Step 3

Get logged in to your sweet Server.

SQL Server

Step 4

Select New Project or for smarties Ctr+Shift+N.

SQL Server

Step 5

Fill out the very first details of your solution, as shown below.

SQL Server

Step 6

The solution is ready for you and is ready to use. Now, select Solution Explorer.

SQL Server

it will show you the details given below.

SQL Server

Now, how I am going to use this?

Hence, let’s go back to my post in which you have just seen/ read a query and have not done actual experiments/ practiced on them.

Thus, I am going to select only the last query, which I liked most from my post i.e.

Find tables with foreign key constraint in the database.

  1. SELECT AS ForeignKey,  
  2.     OBJECT_NAME(f.parent_object_id) AS TableName,  
  3.     COL_NAME(fc.parent_object_id, fc.parent_column_id) AS ColumnName,  
  4.     OBJECT_NAME(f.referenced_object_id) AS ReferenceTableName,  
  5.     COL_NAME(fc.referenced_object_id, fc.referenced_column_id) AS ReferenceColumnName  
  6. FROM sys.foreign_keys AS f  
  7. INNER JOIN sys.foreign_key_columns AS fc  
  8. ON f.OBJECT_ID = fc.constraint_object_id  

Thus, I execute this and I think I can use this in future or I can use this whenever someone asks me about the question about primary key analysis in given DB.

Therefore I am going to save this in my solution, which I have created just now.

Step 7

Right click on Query folder and subsequently click New query.

SQL Server

Press F2 to rename the query. Don’t change extension J and double click on the same.

SQL Server

Paste my query into that plan

SQL Server

Don’t forget to click save i.e.Ctr+S. I am going to save this query on your solution and now, you are ready to use this for any database and you just need to change the database from dropdown instead of master data.

Now, go on creating and dumping your own queries in similar way in your solution.

The developer with good set of queries will be always ahead in the any development phase is key point for this article.

Thus, take one step ahead in developing only one solution and maintain, use, and share this solution throughout your life.

Hope, this helps.


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now