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
 replace function in sql statement

Author  Topic 

jaimin
Starting Member

21 Posts

Posted - 2007-10-15 : 05:23:16
how should i use replace function in sql statement??

in my scenario, user enters the meeting ID and i want that if user enters the meeting ID which includes apostrophe('), the stored procedure should remove the apostrophe before inserting it into database table.

my stored procedure accepts two parameters.
Is there any way to solve my problem??


Jaimin

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-10-15 : 05:32:42
REPLACE(Col1, '''', '')



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-15 : 07:27:27
To know the behavior of single quotes, run this

select '','''','''''','''''''',''''''''''

Also, you should validate data at front end and then send only valid data to sql server table

Madhivanan

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

cbr600gyrl
Starting Member

1 Post

Posted - 2008-04-11 : 12:08:04
Thanks Madhivanan! The select query helped me.
quote:
Originally posted by madhivanan

To know the behavior of single quotes, run this

select '','''','''''','''''''',''''''''''

Also, you should validate data at front end and then send only valid data to sql server table

Madhivanan

Failing to plan is Planning to fail

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-04-14 : 03:18:17
quote:
Originally posted by cbr600gyrl

Thanks Madhivanan! The select query helped me.
quote:
Originally posted by madhivanan

To know the behavior of single quotes, run this

select '','''','''''','''''''',''''''''''

Also, you should validate data at front end and then send only valid data to sql server table

Madhivanan

Failing to plan is Planning to fail




Thanks
Also refer http://sqlblogcasts.com/blogs/madhivanan/archive/2008/02/19/understanding-single-quotes.aspx

Madhivanan

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

- Advertisement -