A Very popular question I often here whenever I am presenting at the developer conference – How to Change Column Property From NULL to Not NULL Value?
SQL SERVER – Puzzle – Brain Teaser – Changing Data Type is Changing the Default Value
Today, we will see a very interesting puzzle about data types and default values.
You need to answer-
1 The original datatype A and default value B
2 The new datatype C and new default value D
SQL SERVER – Find Out Column Name Using COL_NAME() Function
In SQL Server, there are many methods to find out the column names in a table. If you want to find out the column names based on the ordinal position you can do it querying system view size. Columns. Do you know that you can also do this by using COL_NAME() system function?
SQL SERVER – How to Check if a Column Exists in SQL Server Table?
Question: How to check if a column exists in SQL Server table?
SQL SERVER – How to Identify Columns Used In A View?
The views are very tricky. Sometimes they help performance and sometimes they negatively impact performance. Recently, during Comprehensive Database Performance Health Check, I realized that one of the view was the real performance killer. The challenge was to identify column used in a view. We decided to open the view and list all the columns but that was very cumbersome tasks. Finally, we decided to write a script which can help identify columns used in a view.
SQL SERVER – Script: Remove Spaces in Column Name in All Tables
Long time ago I have written blog to rename column name.
SQL SERVER – How to Rename a Column Name or Table Name
One of the reader asked me if I can provide a script to remove space from all column names for all tables in a database? My first reaction was – “Are you sure you want to do that? There are chances that after changing the name of the column, the application code might break. If the table has been referred in stored procedure or functions or other objects”