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.
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_SQLCMDThe ms sql not accept the "" for !empty value is there a way to work aroundBest 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 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
|
|
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 |
|
|
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 |
|
|
issammansour
Yak Posting Veteran
51 Posts |
Posted - 2007-09-30 : 15:16:28
|
May be it will not work?? Specially with exec command!! |
|
|
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 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com |
|
|
sunj.sql
Starting Member
1 Post |
Posted - 2007-10-01 : 01:18:35
|
How about using WHERE YEAR = 2007 and catcode IS NOT NULL |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-10-01 : 02:25:27
|
"WHERE YEAR = 2007 and catcode IS NOT NULL"catcode IS NOT NULLis NOT the same ascatcode <> ''Kristen |
|
|
|
|
|