1

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

4 Answers 4

2

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

Sign up to request clarification or add additional context in comments.

Comments

2

Try something like this:

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

1 Comment

Oh yeah, I did not think of just doing null like that. Might be more performant too
0
SELECT empname, Isnull(empaddress,'')empaddress, empDeptid FROM empiD=3

Comments

-1

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.