Hi
I want to check if the values of a column from a table is blank (i.e. empty but not null) . If it is blank, then I want to replace it with some other text. Is there some function like, Isnull or coalesce in SQL Server 2000, with which I can check if the value is blank and replace it. I want to use it as part of query so, I do not wish to use if trim(...) etc.
If any one has an solution, please do tell me.
Regards
Vineed
Here it is,
Code Snippet
Create table #Data(
ValueColumn varchar(100)
)
Insert Into #Data Values(' ');
Insert Into #Data Values('');
Insert Into #Data Values(' ');
Insert Into #Data Values(' ');
Insert Into #Data Values(NULL);
Insert Into #Data Values('Some value');
Select Case When ValueColumn='' Then '(Empty)' Else ValueColumn End From #Data
No comments:
Post a Comment