Tag Archives: SQL

How to rename a table or column using T-SQL in Microsoft SQL

So yeah, you could use the Microsoft SQL Server Management Studio UI to rename your table or column. But sometimes you need to do the rename in T-SQL. Here’s how. How to rename a table: EXEC sp_rename ‘OldTableName’, ‘NewTableName’ How … Continue reading

Posted in Web & Software Development | Tagged , | 10 Comments

How to apply UNIQUE constraints to existing SQL columns

I wanted to add this to my blog because I had some difficulty finding out (via Google) how to add a UNIQUE constraint to a SQL column that already existed. To bring you up to speed, UNIQUE constraints prevent duplicate … Continue reading

Posted in Web & Software Development | Tagged | 1 Comment

A Haunting SQL Statement

An interesting thing happened to me yesterday. A coworker came up to me and asked, “Did you write this SQL statement?” After looking at it I realized it was a statement I had written about a year ago. In this … Continue reading

Posted in Web & Software Development | Tagged | 2 Comments

What's the difference between SQL's Truncate Table and Delete From Table?

Thought I’d add a small nugget of SQL knowledge I recently acquired to the blog; the difference between truncate table and delete from table. Both are ways to remove all the rows from a table, but which one should you … Continue reading

Posted in Web & Software Development | Tagged | Leave a comment