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
 General SQL Server Forums
 New to SQL Server Programming
 Replacing blanks

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-31 : 07:17:35
Nevil Mascarenhas writes "Hi SQL team,

I am just a beginer in SQL

Here is sample output of a SQL query

Alarm No Site Name Startdate Starttime

7767 ABC 20-08-05 00:00
7765 XYZ 20-08-05 00:00
7762 ASD
5453 QWE 22-08-05 01:00

In this above example, I would like to replace blank fields in Startdate and Starttime coloumn with XXX

Output required is

Alarm No Site Name Startdate Starttime

7767 ABC 20-08-05 00:00
7765 XYZ 20-08-05 00:00
7762 ASD XXX XXX
5453 QWE 22-08-05 01:00

Can you please guide me."

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-31 : 07:41:50
If you want to show this in your Presentation layer like Reports, you can do this formation there
Otherwise use this

Select AlarmNo ,SiteName ,case when Startdate is null then 'XXX XXX'
else Convert(varchar,StartDate,101) end from yourTable

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -