All Articles sqlcmd-backup-restore-600x400

SQL SERVER – Backup and Restore Database Using Command Prompt – SQLCMD

Backup and Restore is one of the core tasks for DBAs. They often do this task more times than they would have ideally loved to do so. One thing I noticed in my career that every successful DBA knows how to automate their tasks and spend their time either playing games on a computer or learning something new!

Read More

SQL SERVER – Generate Random Values – SQL in Sixty Seconds #042 – Video

Though it looks simple it is very difficult to generate random numbers which one can’t guess. There are many different ways to generate random values in SQL Server. I have previously blogged about it over here where I have demonstrated five different methods to generate random values in SQL Server.…
Read More

SQL SERVER – Fix: Error: 1505 The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name and the index name

Here is another example where the error messages are very clear but often developers get confused with the message. I think the reason for the confusion is the word “Key” used in the error message. After I explained this to a developer who sent me the error he realize that…
Read More

SQL SERVER – Fix Error: 8111 – Cannot define PRIMARY KEY constraint on nullable column in table – Error: 1750 – Could not create constraint. See previous errors

A very common error new developers receive when they begin with SQL Server and start playing with the keys. Let us first run following code which will generate an error 8111. -- Create Table CREATE TABLE test (ID INT, Col1 INT, Col2 VARCHAR(100)) GO -- Now create PK on ID…
Read More
All Articles spicon

SQL SERVER – Significance of Table Input Parameter to Stored Procedure

SQL Server has introduced a functionality to pass a table data form into stored procedures and functions. This feature greatly simplifies the process of developing. The reason being, we need not worry about forming and parsing XML data. With the help of the table Input parameter to Stored Procedure we can save many round trips. Any SQL training will vouch for the fact that SQL is capable of accepting large, complex data in the form of parameters in a stored procedure.

Read More
All Articles 41-600x400

SQL SERVER – Autocomplete and Code Formatting Tool – SQL in Sixty Seconds #041 – Video

I love to write code, and I love well-written code. When I am working with clients, and I find people whose code have not been written properly, I feel a little uncomfortable. It is difficult to deal with code that is in the wrong case, with no line breaks, no white spaces, improper indents, and no text wrapping. The worst thing to encounter is code that goes all the way to the right side, and you have to scroll a million times because there are no breaks or indents. Let us see blog post about Code Formatting Tool.

Read More