SQL developers are increasingly required to include tracking data changes into their custom applications. The information about what change was made – insert, update or delete – who made it, when, and also which computer and application was used, is very useful and can be essential for troubleshooting.April 4, 2013
If you ever needed to quickly revert an inadvertent change such as an UPDATE without a WHERE clause, to recover missing or corrupt data, to move data across your development, test, integration and production environments or even just to avoid generating a report using a busy production SQL Server database as a data source, you must’ve wondered if there is a way just to restore specific rows instead of restoring the whole database backup.April 4, 2013
Very often, initial database design does not fit the current criteria and requirements anymore. It is therefore necessary to periodically align to what our current needs and standards are. When working with a large database, any idea of changing the name of one or more SQL objects can be a real challenge.
Changing an object name is a simple operation and it could be done easily using the SP_RENAME system stored procedure or by utilizing the RENAME and ALTER… RENAME statements for indexes and triggers.April 4, 2013
Renaming a table or view column is not something a SQL developer needs to do every day. However, when the time comes, how can it be done easily and effortlessly?
Just renaming a column is not difficult. To rename the column TerritoryID in the Sales.SalesTerritory table into TerID, execute the following statement:April 4, 2013
When trying to delete a database object, which has an object that depends on it, no problems can be caused, since it will not allow to be deleted:
Drop failed for Table ‘HumanResources.Employee’. (Microsoft.SqlServer.Smo)
Could not drop object ‘HumanResources.Employee’ because it is referenced by a FOREIGN KEY constraint.
If your SQL queries perform sluggishly and severely impact SQL Server performance, the solution can be closer than you think – in some cases all you need to do is not to use the * wildcard in the SELECT statement.April 4, 2013
Many DBAs think of database documentation as “grunt work”. It’s one of those tasks that you never have enough time for, as you’re always busy with other higher priority tasks.
But what if it could be made automatic?April 4, 2013
Every production database requires maintenance and improvements in order to meet the ever-changing demands. The easiest way to test the new requirements, such as new functionalities and improvements, is to try them on a test database.
So, creating the test base from the backup of the production database would be the easiest way… at least that’s what it looks like. But, is this really the case?April 4, 2013
All of a sudden, you realize that something’s wrong with your database objects. Some stored procedures are missing, functions are there but they don’t work as expected since their code seems to be altered, and some triggers are created and fired which enhances the chaos you’re in.
After the initial shock, you start investigating. Don’t rule out a SQL injection attack, as it’s one of the most common web application security issues.
What is a SQL injection?
A SQL injection attack is an attack in which a code that attacks the database is inserted into a web site. It’s one of the most common types of web application security vulnerabilities. So it’s better to be prepared, or at least well informed
SQL injections can have an immediate (first-order attacks) and delayed effect (second-order attacks)