?
Solved

sql: i need a logic that would allow me to check whether column is empty

Posted on 2007-11-23
5
Medium Priority
?
196 Views
Last Modified: 2010-03-20
i am doing the following:

insert  table1
select
          'Text' + ifnotnul(col1) else xyz
from table2

how do i correctly specify in sql:  'Text' + ifnotnul(col1) else xyz.
0
Comment
Question by:gogoshar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 20339345
select
          'Text' + COALESCE(Col1,xyz)
from table2
0
 
LVL 6

Expert Comment

by:wshark83
ID: 20339424
select case when <col1> <> ' ' then <col1> else 'xyz' end as <Newcolumnname>
from <tablename>
0
 
LVL 6

Expert Comment

by:wshark83
ID: 20339441
sorry also just add text + ' ' + before case statement
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20953228
Forced accept.

Computer101
Community Support Moderator
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question