Solved

Identify a column is NULLABLE or not throughout the DB

Posted on 2013-06-07
2
235 Views
Last Modified: 2013-06-07
In my DB 'CreatedDtm' column is present in all the tables. I would like to know in all the tables the column is NOT NULLABLE. How to ensure that without scanning each table by table using TSQL?


Please do assist.
0
Comment
Question by:Easwaran Paramasivam
2 Comments
 
LVL 8

Expert Comment

by:didnthaveaname
ID: 39228781
Should be able to accomplish this with a join of sys.columns (http://msdn.microsoft.com/en-us/library/ms176106.aspx) and sys.tables (http://msdn.microsoft.com/en-us/library/ms187406.aspx)
0
 
LVL 7

Accepted Solution

by:
Ross Turner earned 500 total points
ID: 39228813
Try This:

select st.name,sc.name,sc.is_nullable from sys.columns sc
inner join sys.tables st on sc.object_id = st.object_id
where sc.name like 'CreatedDtm'

Open in new window

0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
Introduction: When running hybrid database environments, you often need to query some data from a remote db of any type, while being connected to your MS SQL Server database. Problems start when you try to combine that with some "user input" pass…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question