Category Archives: T-SQL

How to Create Table and define data integrity

In this post I will show you how you can create table and define data integrity on the table’s data. To explain you with example I create a new database on my SQL Server instance with the name “sampleDB”. Here … Continue reading

Posted in T-SQL | Tagged , , , | Leave a comment

Create Table in SQL

In this example i show you How you can create New table in a Database. For my example i use tempDB database.     –use tempDB database context use tempDB; –Drop Employee table if already exists in tempDB database If … Continue reading

Posted in T-SQL | Tagged | Leave a comment

Trick: Importing data from Excel using INSERT statements…

To Import data from excel to Sql table using SQL Import/Export tool is simple and very effective. But we can import large tables into Sql table by generating insert statements in excel sheet. Here is the trick that i found … Continue reading

Posted in T-SQL | Tagged | Leave a comment

Clearing the Cache

Sometimes you need to clear the cache, for example when you want to analyze query performance. SQL Server provide some tools to clear both data and execution plans from the cache. Here I am explaining those tools. To clear data … Continue reading

Posted in T-SQL | Tagged , | Leave a comment

XML and XQUERY Language: Part 2 (FOR XML EXPLICIT and FOR XML PATH)

  In my last post in covered two options (FOR XML RAW and FOR XML AUTO) to convert relational data into XML representation. Click on this link to read that post (http://sqlenthusiast.blogspot.com/2012/01/xml-and-xquery-language-part-1for-xml.html). In today’s post I will explain other two … Continue reading

Posted in T-SQL | Tagged , , , , , , | Leave a comment

XML and XQUERY Language: Part 1(FOR XML RAW and FOR XML AUTO)

  Hello Folks!   Today I will write about XML support in SQL Server. I will also conclude in the last about How important XML support in SQL and when should we, when shouldn’t we use XML support.   SQL … Continue reading

Posted in T-SQL | Tagged , , , , , , | Leave a comment

Error Handling in Transactions using Try/Catch

In this post I will explain Error handling concept with Try/Catch construct in SQL Code.   What happens when error occurred in a transaction ? If you are not using Try/Catch construct and error occurred in an explicit transaction then … Continue reading

Posted in T-SQL | Tagged , , , , , | Leave a comment