Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Null Question

Author  Topic 

callawayx14
Yak Posting Veteran

73 Posts

Posted - 2008-03-20 : 10:33:57
I'm working in a new environment and I'm not completely familiar with all the tables/fields in the DB. If I've written a query or if I know the fields and tables I plan to use, is there an SP or somethign that I can run to check to see which fields allow nulls?

I ask because I will be filtering on many of the fields and I'm trying find a quick way to determine which fileds I need to include the (isnull(??,0) = 0) ect

Thank you...I appreciate your help

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-03-20 : 10:36:52
You can use sp_help <table_name> to get column info. and look into column nullable to see those columns which allow NULLS.
You can also have a look at system table syscolumns for this
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-03-20 : 10:37:00
Check the value of IS_NULLABLE column in INFORMATION_SCHEMA.COLUMNS view.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

elancaster
A very urgent SQL Yakette

1208 Posts

Posted - 2008-03-20 : 10:37:02
have a look at INFORMATION_SCHEMA.COLUMNS

Em
Go to Top of Page

callawayx14
Yak Posting Veteran

73 Posts

Posted - 2008-03-20 : 10:39:10
Thank you very much.....!!!!
I appreciate your help
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2008-03-20 : 10:40:41
select name, is_nullable from sys.columns where object_id = (select object_id from sys.objects where name = '<yourTable>')

1 = Nullable
Go to Top of Page
   

- Advertisement -