happysmile
happysmile

Reputation: 7777

Sql query with default value

I have a select Query in employee table. I need to make sure that column value(empaddress) always pass an empty value in select query:

SELECT 
    empname,
    empaddress,
    empDeptid  
FROM 
    empiD=3

I know that empaddress can contain any value like Null or data. But in the result set it should always be blank

Upvotes: 1

Views: 288

Answers (4)

Simon
Simon

Reputation: 43

Simply add ISNULL function with '' and it will appear blank:

SELECT 
    empname,
    ISNULL(empaddress,'') AS EmpAddress,
    empDeptid  
FROM 
    empiD=3

Upvotes: -1

senthilkumar2185
senthilkumar2185

Reputation: 2566

SELECT empname, Isnull(empaddress,'')empaddress, empDeptid FROM empiD=3

Upvotes: 0

7alhashmi
7alhashmi

Reputation: 924

Try something like this:

SELECT 
    empname,
    null as empaddress,
    empDeptid   
FROM 
    empiD=3;

Upvotes: 2

ScottJShea
ScottJShea

Reputation: 7111

You could do something like this:

SELECT 
    empname,
    "" as empaddress,
    empDeptid   
FROM 
   empiD=3

Unless I am missing something here that would return a blank string in place of the empaddress

Upvotes: 2

Related Questions