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
 Transact-SQL (2000)
 T_SQL HASNOVALUE but NOTNULL

Author  Topic 

SKP
Starting Member

34 Posts

Posted - 2006-03-27 : 09:57:05
Hi!
I have a situation where my data from the column is not null, but it is blank, is there any T-Sql function to check whether a data is blank or not.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-27 : 09:59:13
is it a string column ? blank as in empty string ?
use
yourstringcolumn = ''




KH

Choice is an illusion, created between those with power, and those without.
Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant

Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2006-03-27 : 09:59:35
where col = ''
instead of
where col is null


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-03-27 : 10:14:59
or

we use this function for checking the emptystring ..


CREATE FUNCTION IsEmptyVarChar (@CheckVariable Varchar(8000))
RETURNS varchar(8000) AS
BEGIN
IF LEN(LTRIM(RTRIM(@CheckVariable)))= 0
BEGIN
SET @CheckVariable = NULL
END
RETURN @CheckVariable
END


Where Dbo.IsEmptyVarChar(Col) Is Null -- These means its empty



If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

SKP
Starting Member

34 Posts

Posted - 2006-03-27 : 10:39:35
Thanks Chirag,

Your function did my job , I wrote similar function, but i was not using trim and checking the length as 0, I was checking ISNULL or ' '.
Obviously ' ' didn't work.

But your code is good, thanks.

Thanks to all of you who replied. Appreciate your valuable time.
Go to Top of Page
   

- Advertisement -