Showing posts with label SQl Queries. Show all posts
Showing posts with label SQl Queries. Show all posts

Thursday, February 17, 2011

Saving Changes Not Permitted. Common Problem in SQL SSMS & Solution

While using SQL Server Management Studio (SSMS) for altering design of tables, we often see the below crappy window saying that, your changes can not be saved.


This happens because the changes that you have done require associated tables to be re-created. And by default this re-creation options is turned off the SSMS.

These same changes you can do using SQL commands without any complaint & that’s the reason I (and many of you) love to do things using SQL commands rather than using SSMS. Regardless, for the SSSMS lovers snapshot below shows the option which helps you out in such scenario.

Go to Tools > Options in SSMS and make sure that highlighted option is unchecked. That’s it and you can do whatever changes you want to do to the table schema using SSMS.

I hope some of you might find this post useful.
Cheers,

Saturday, August 14, 2010

How to find Tables with NO INDEXES...??

Often times when your application is not performing well as it used to, then you start blaming your SQL developer for the bad queries. But this may not be the case all the time. For your application to work fast, you should also have proper indexes in the underlying database.

When your application is not working as fast as it used to, then first check that you might want to do is to check if you have proper indexes in place. One very obvious check that you might want to do will be to indentify tables which are not having any indexes at all. Now how you do that?

Open the SSMS, and check all the tables one by one inside your database..!! Pretty time consuming and so manual, right.

I got this very handy SQL script which will do the job for you very quick. Execute the below script on your database and you will get all the list of all culprit tables.

SELECT name

FROM
sys.tables

WHERE
OBJECTPROPERTY(OBJECT_ID,'TableHasIndex')=0

Hope that you will find this post useful.

Cheers,

Saturday, August 7, 2010

Best Practices for SQL Queries

I was looking into best practices for writing SQL queries and came across one very interesting and useful online resource/post. This post focuses on how to write understandable, maintainable and readable queries. Good post for SQL queries code review, Below is the link.


Enjoy coding..!!!