- · It’s very basics in SQL
- · But nobody make use of it except smart DBA’s and Few BI Experts.
- · We can make solution in SQL Server and reuse any version
Question in my mind is why I should create solution in SQL server? What is its use and purpose for small and large, long 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 required queries with you e.g.: for optimization, indexing queries.
- You can start dumping all of your queries and can analyze them as well
So how to start with!!! How to develop it?
It’s as easy as you create new word document and save it!!
Follow the steps :
Step 1.Click on start

Step 2.Select SQL Server Management Studio

Step 3. Get login to your sweet Server

Step 4.Select New Project or for smarty’s Ctr+Shif+N

Step 5. Fill out Very first Details of your Solution as shown

Step 6.That's it solution is ready for you and for ready to use,now Select Solution Explore

it will show you following details

Now how I am going to use this!!!
So let’s go back to our past post, in which you have just seen/read query n not done actual experiment/practical on them.
So I am going to select only last query which I liked most from my post i.e
--Find Tables With Foreign Key Constraint in Database
SELECT
f.name AS ForeignKey,
OBJECT_NAME(f.parent_object_id) AS TableName,
COL_NAME(fc.parent_object_id,
fc.parent_column_id) AS ColumnName,
OBJECT_NAME (f.referenced_object_id) AS ReferenceTableName,
COL_NAME(fc.referenced_object_id,
fc.referenced_column_id) AS ReferenceColumnName
FROM sys.foreign_keys AS f
INNER JOIN sys.foreign_key_columns AS fc
ON f.OBJECT_ID = fc.constraint_object_id
So I execute this and I think I can use this in future or I can use this whenever someone ask me about question about primary key analysis in given DB.
So I am going to save this in my solution which I have created just now.
Step 7. Right Click on Query folder and then click on new query

Press F2 to rename the Query don’t change extension J and double click on the same

And paste my query into that plan

Don’t forget to click on save Ctr+S. Which going to save this query on your solution and now you can ready to use this for any database just need to change Database from dropdown instead on master data.
Now go on creating and dumping your own queries in similar way in your solution whatever you feel is good, very useful, always in use type of query!!
Developer with good set of queries will be always ahead in the any development phase is key point for this article.
So take one step ahead develop only one solution and maintain, use, share this solution thorough your life.
Hope this helps !!!