| Author |
Topic |
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2009-01-15 : 09:03:55
|
| i have done this before but cant remember.i want to TRIM the Column and compare it to ''' |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-01-15 : 09:05:41
|
SELECT *FROM Table1WHERE Col1 IS NULL OR Col1 = '' E 12°55'05.63"N 56°04'39.26" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-15 : 09:06:51
|
| [code]SELECT *FROM Table1WHERE Col1 > ''[/code] |
 |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2009-01-16 : 05:27:46
|
| hican anyone see whats wrong with thisselect CashID ,rtrim(Notes)from dbo.Cash_Balances get this errorArgument data type text is invalid for argument 1 of rtrim function. |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-16 : 05:30:32
|
quote: Originally posted by rjhe22 hican anyone see whats wrong with thisselect CashID ,rtrim(Notes)from dbo.Cash_Balances get this errorArgument data type text is invalid for argument 1 of rtrim function.
TRY THISselect CashID ,rtrim(CAST (Notes AS VARCHAR(8000)))from dbo.Cash_Balances |
 |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2009-01-16 : 05:31:43
|
| why did u put (CAST (Notes AS VARCHAR(8000)) in |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-16 : 05:34:13
|
quote: Originally posted by rjhe22 why did u put (CAST (Notes AS VARCHAR(8000)) in
RTRIM Cannot be used with text datatype...It can be used only with varchar or nvarchar |
 |
|
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2009-01-16 : 05:34:28
|
| May Be Ur datatype is not of varchar,,,,so cast use is there to convert it to varchar..... |
 |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2009-01-16 : 05:39:01
|
| ok right i understand now thanks |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-16 : 05:43:14
|
quote: Originally posted by rjhe22 ok right i understand now thanks
welcome... |
 |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2009-01-16 : 05:56:19
|
| thats work but it pulling all the records back.im trying to RTRIM the Column and compare it to '''.am i on the right track |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-16 : 06:01:49
|
quote: Originally posted by rjhe22 thats work but it pulling all the records back.im trying to RTRIM the Column and compare it to '''.am i on the right track
Please Post full query which u are using...where are you trying compare it to ''' |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-16 : 06:04:41
|
| what is the need of rtrim and comparing the values with empty string |
 |
|
|
rjhe22
Constraint Violating Yak Guru
283 Posts |
Posted - 2009-01-16 : 06:05:28
|
| incase some of them that have notes dont have a blank space before it |
 |
|
|
Jai Krishna
Constraint Violating Yak Guru
333 Posts |
Posted - 2009-01-16 : 06:07:46
|
| SELECT *FROM Table1WHERE ISNULL(LTRIM(RTRIM(Col1)),'') = ''Jai Krishna |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-16 : 06:09:07
|
| I think what u need is ltrim..anyway to get correct solution please post some sample data and expected output.. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-01-16 : 07:30:11
|
| where text_col is not null or datalength(text_col)>0MadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-16 : 08:53:08
|
quote: Originally posted by raky
quote: Originally posted by rjhe22 why did u put (CAST (Notes AS VARCHAR(8000)) in
RTRIM Cannot be used with text datatype...It can be used only with varchar or nvarchar
what happens if Notes is a text field and has over 8000 characters? have you considered that |
 |
|
|
|