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 2005 Forums
 Transact-SQL (2005)
 Using 's in update query

Author  Topic 

Riklinssen
Starting Member

20 Posts

Posted - 2008-11-05 : 10:40:02
Hello,
In Holland we've got name like 't Oever I like to split 't from oever and put it in different columns. I use the update query below but I have a problem with the ' sign in 't. The [ ] or " " signs does not help to make clear it is a part of the name and not part of the sql language.

Update persons
set Voorv = '['t]', naam = substring (naam,4,50)
Where Naam like ''t %'
Go

How can I solve this problem

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-05 : 10:49:11
[code]UPDATE Persons
SET VoorV = '''t',
Naam = SUBSTRING(Naam, 4, 50)
WHERE Naam LIKE '''t %'[/code]


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-05 : 11:50:30
see this also

http://sqlblogcasts.com/blogs/madhivanan/archive/2008/02/19/understanding-single-quotes.aspx
Go to Top of Page

Riklinssen
Starting Member

20 Posts

Posted - 2008-11-06 : 03:44:02
Thank you for your fast reply. It works
Go to Top of Page
   

- Advertisement -