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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to update Question mark

Author  Topic 

ceema
Yak Posting Veteran

80 Posts

Posted - 2006-11-27 : 07:17:42
Hello all,

By mistake one of my sql table field got filled with Question mark. Like Student is my table name and it's having two fields regno & name

Student
-------

RegNo Name

101 abc
102 efg
104 ??
105 ?
106 ???
107 hij


Now I want to replace the name field with ? with a null value like

Student
-------

RegNo Name

101 abc
102 efg
104
105
106
107 hij

I have tried the following statement, but of no use. Please help

update student set sarabicname='' where sarabicname=' %+? + % '


Thanks
Ceema

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-27 : 07:20:57
[code]update student set sarabicname=''
where sarabicname='?%'
[/code]


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

ceema
Yak Posting Veteran

80 Posts

Posted - 2006-11-27 : 07:28:13
No Harsh,

No, that I tried already, but of no use. Anyother way?

Ceema

quote:
Originally posted by harsh_athalye

update student set sarabicname='' 
where sarabicname='?%'



Harsh Athalye
India.
"Nothing is Impossible"

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-27 : 07:31:18
What is the datatype of name?

Try this

update student set sarabicname=Replace(sarabicname,'?','')

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-27 : 07:35:52
I think Harsh meant LIKE, not equal to
update student set sarabicname = '' 
where sarabicname like '?%'


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

ceema
Yak Posting Veteran

80 Posts

Posted - 2006-11-27 : 07:38:48
Hello,

Yesss, now it's working with like, thank you both of you.

Thanks again

Ceema

quote:
Originally posted by Peso

I think Harsh meant LIKE, not equal to
update student set sarabicname = '' 
where sarabicname like '?%'


Peter Larsson
Helsingborg, Sweden

Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-27 : 07:39:01
quote:
I think Harsh meant LIKE, not equal to


Damn, Copy-Paste again!!

Yeah, that's what I meant..Thanks peter.

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-27 : 07:40:55
What do you want to do if name has 'test????' ?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-27 : 07:46:25
Question mark anywhere
update student set sarabicname = ''
where sarabicname like '%?%'

Only question mark
update student set sarabicname = ''
where sarabicname not like '%[^?]%'


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -