Solved

varchar null or ''

Posted on 2010-09-21
4
406 Views
Last Modified: 2012-06-27
varchar internalsku1

if internalsku1 is null or internalsku1='' use 111
0
Comment
Question by:rgb192
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 33725349
isnull(nullif(internalsku1, ''), '111')
0
 
LVL 16

Expert Comment

by:vdr1620
ID: 33725399
You can also try the below sql


SELECT CASE WHEN internalsku1 IS NULL OR internalsku1 = '' THEN '111' END FROM TableName
0
 
LVL 12

Expert Comment

by:jagssidurala
ID: 33732108
Better to use like below.

Select      IsNull(NullIf(LTRIM(RTRIM(internalsku1)), ''), 111)
From      tableName
0
 

Author Closing Comment

by:rgb192
ID: 33762573
thanks
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

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

INTRODUCTION: While tying your database objects into builds and your enterprise source control system takes a third-party product (like Visual Studio Database Edition or Red-Gate's SQL Source Control), you can achieve some protection using a sing…
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now