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.
| Author |
Topic |
|
sqlnewbie82
Starting Member
11 Posts |
Posted - 2007-10-19 : 14:21:34
|
| i want to check if one of the fields is empty. however i cant seem to get it working string strSQL = "select * from 15Course_Listing where Package_listingNo =''";it does not return anything, however i have empty fields in package_listingNoi have been trying to get around this for some time and its killing me. need help please |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-10-19 : 14:31:12
|
| Try running your query in Management Studio or Query Analyzer. Does it work there? What condition in your data means it is empty? The empty string such as '', NULL values, a blank space?Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
KenW
Constraint Violating Yak Guru
391 Posts |
Posted - 2007-10-19 : 14:42:42
|
quote: Originally posted by sqlnewbie82 i want to check if one of the fields is empty. however i cant seem to get it working string strSQL = "select * from 15Course_Listing where Package_listingNo =''";it does not return anything, however i have empty fields in package_listingNoi have been trying to get around this for some time and its killing me. need help please
Unless you're specifically setting the column to have a value of "", an empty column in SQL Server would be NULL. Your query should be select * from 15Course_Listing where Package_listingNo IS NULL |
 |
|
|
sqlnewbie82
Starting Member
11 Posts |
Posted - 2007-10-19 : 14:43:58
|
| i tried that it, still does not work. i am entering information through a webform and it gets updated to this table. so i want to check if the field has been left blank. |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-10-19 : 15:07:45
|
| If neither '' or IS NULL works, then the data has not been saved that way to the table. Check the data in SSMS or QA.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
Zoroaster
Aged Yak Warrior
702 Posts |
Posted - 2007-10-19 : 16:24:20
|
It could be a special character such as a return space, you can see this if you open through enterprise manager, it will show up as a square. This commonly happened via forms when people pasted information into form fields. Future guru in the making. |
 |
|
|
|
|
|