Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Checking !empty() Cell

Author  Topic 

issammansour
Yak Posting Veteran

51 Posts

Posted - 2007-09-29 : 11:47:47
hi,

I have the following statement:

SET @L_SQLCMD='DECLARE TMPRecord CURSOR STATIC FOR '+
'select TOP 1 CATCODE From IMS.CATEGORY WHERE YEAR = 2007 and catcode <> ""'

exec @L_SQLCMD

The ms sql not accept the "" for !empty value is there a way to work around

Best Regards


spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-09-29 : 11:56:10
change " to ''
why do you need a cursor for?


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

issammansour
Yak Posting Veteran

51 Posts

Posted - 2007-09-29 : 12:00:42
this statement is part of S.P. thats way the cusor but you can take it off
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-09-30 : 05:19:45
[code]
'select TOP 1 CATCODE From IMS.CATEGORY WHERE YEAR = 2007 and catcode <> '''''
[/code]
Kristen
Go to Top of Page

issammansour
Yak Posting Veteran

51 Posts

Posted - 2007-09-30 : 15:16:28
May be it will not work?? Specially with exec command!!
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-09-30 : 15:21:11
what do you mean maybe??
have you tried to run it?

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

sunj.sql
Starting Member

1 Post

Posted - 2007-10-01 : 01:18:35
How about using

WHERE YEAR = 2007 and catcode IS NOT NULL
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-01 : 02:25:27
"WHERE YEAR = 2007 and catcode IS NOT NULL"

catcode IS NOT NULL

is NOT the same as

catcode <> ''

Kristen
Go to Top of Page
   

- Advertisement -