469,579 Members | 1,181 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,579 developers. It's quick & easy.

empty status of a variable

The example bellow will receive a parameter.

create procedure usp_InsertProducts
@SKU varchar(30)

Now how do I check whether is @SKU empty or not.

Your help is kindly appreciated.
Regards

Eugene Anthony

*** Sent via Developersdex http://www.developersdex.com ***
Jul 23 '05 #1
1 1467
> how do I check whether is @SKU empty or not.

IF @sku IS NULL ...

or

IF @sku = '' ...

depending on what you mean by "empty".

To differentiate between a NULL and no value specified you could
provide a default using some invalid token to represent the missing
value:

CREATE PROCEDURE usp_InsertProducts
@sku VARCHAR(30) = '<Unspecified>'
AS ...

IF @sku = '<Unspecified>'
...

--
David Portas
SQL Server MVP
--

Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Wayno | last post: by
8 posts views Thread by Ricky K. Rasmussen | last post: by
13 posts views Thread by Alexander Widera | last post: by
59 posts views Thread by Steve R. Hastings | last post: by
1 post views Thread by =?Utf-8?B?Um9nZWxpbw==?= | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.