Apostrophe In Cell

Jan 8, 2008

I need help with a simple query. We have 86 entries with the City of O'Fallon in our db. How do I do this with the apostrophe in O'Fallon? Below is just to give an idea of what I want. Thanks.

SELECT *

FROM Organization

WHERE City=O'Fallon

View 2 Replies


ADVERTISEMENT

Reporting Services :: Number In Cell Formatted As Text Or Precedence By Apostrophe

Oct 26, 2015

on this report, am having ids separated by '^'.when I export to excel, I wrote the expression as

=Replace(Fields!Id.Value,"^",Environment.NewLine)

It is working fine, but the problem is if I have only one id in some scenario, then this case that cell is showing an error "The Number in this cell formatted as text or precedence by apostrophe" .But in other scenario,If the ids are separated by "^", then this case that cell wont show any error. So I need to display the cell wont have any error symbol  if I have only one id .How can I achieve this?.

View 4 Replies View Related

Copying An Ntext Cell From One Cell Into Another (destination Row Already Exists)

May 6, 2004

Hi!

What I'd like to do is:

UPDATE table1
SET
A_TEXT_COLUMN = (SELECT another_text_column
FROM table2
WHERE table2_id = @precomputed_id_1)
WHERE table1_ID = @precomputed_id_2

Since the cells are text, this does not work. Since the cell to be updated is in an already exitant row, it's not possible to simply use insert.

I'd like to do something like (PSEUDOcode):

WRITETEXT(table1.A_TEXT_COLUMN, READTEXT(@textptr_initialised_to_point_at_target_c ell))

But the *actual* synatx of WRITETEXT and READTEXT seem totally inappropriate for any such trick...

Any hints or pointers HUGELY appreciated... THANX

View 1 Replies View Related

Is There A Way To Do Mass Formatting Of Cells In A Table Instead Of Cell By Cell?

Oct 5, 2007



Hi,
I'm working with MRS and I've got a table with a lot of entries. For each value in the table I'm trying to get the text colour to be set to 'red' when the value of the cell is less than 0. Otherwise remain black.

I can do this by setting the colour property cell by cell. But I have a lot of cells in the table. Is there a way to set the statement to apply to ALL cells in the table?

Basically I'm asking if there is a way to set the property in bulk instead of going through tediously cell by cell.

Any help would be much appreciated. Thanks!

View 4 Replies View Related

READ EXCEL DATA CELL BY CELL FROM SP

Jul 20, 2005

HI,I HAVE AN EXCEL SHEET WITH SOME DATA, I WANT TO IMPORT THAT DATA (CELLBY CELL WITH MANIPULATION) INTO THE SQL SERVER TABLES BY USING STOREDPROCEDURE(IF POSSIBLE).IF ANYBODY HAVE DONE SIMILER TYPE OF JOB OR KNOWING ABOUT IT, PLS. LETME KNOW.THANKS IN ADV.T.S.NEGI

View 4 Replies View Related

Apostrophe

Aug 9, 2005

how do i search a column and find all rows where there is a single ' in the column?

View 2 Replies View Related

Apostrophe

Jul 20, 2005

i'm using delphi 7 and have a query in which i'm trying to find namesthat have an apostrophe in them, i.e. "o'mally". my problem is thatwhen i write my select statement i can't get the quotes right. i getall types of errors no matter what i try. i get "missing right quote","invalid token" etc. i've tried using QuotedStr and nothing works.here is my current attempt in which i get an "invalid use of keyword.token: n'%'"sSQL := 'SELECT statenotified, notary_id, LastName, FirstName,' +' MiddleInitial, Indep, Book_number, Page_number,' +' CloseRec, TermBegins, TermEnds, DatePickedUp,FailedToQualify,' +' Notes, SOSLtrSent FROM notaries WHERE LastName LIKE '''+''+ edtLastName.Text+'+''%'' AND CloseRec = 1 order bylastname';

View 2 Replies View Related

SQL Query: That Contain Apostrophe

Dec 3, 2007

Hi Friends,
I have stored names with ' s (Apostrophes) and without 's  in the database(sqlserver).Example:O'Relly
I tried to get the values with select statement like
Dim str As String = Request.QueryString("Title")
Dim query As String = "SELECT * FROM Test where title like '" + str + "'"
Problem is getting the all the values from database except O'Relly just getting O other word Relly no.....
What should do I and what code do I need ..?
 
I tried with the below code also
Dim x As Long
For x = 1 To Len(str)
If Mid$(str, x, 1) = "'" Then
str = str & "''"
Else
str = str & Mid(title1, x, 1)
End If
Next
 
 
Need help ,
Thanks.
 
 

View 10 Replies View Related

Will Not Accept Apostrophe

Mar 7, 2005

I get this error when the user inputs a word with an apostrophe:
Incorrect syntax near 't'. Unclosed quotation mark before the character string '

Using c# this is the input command:

oCom=new SqlCommand(string.Format("INSERT INTO [database] ([name],[address], [issue],[comments],[timestamp]) VALUES({0},'{1}','{2}','{3}','{4}",val[0],val[1],val[2],txtComment.Text,tmStamp),oCon);

When users enter a comment with an aprostrophe it gives me an error, using a session array and convert it to a string[].

Any ideas?

Thanks

View 1 Replies View Related

Trim An Apostrophe Off Of A Last Name

Apr 16, 2002

we need to cut the aprostrophe out of a name (ie...o'brien, o'leary) to create userid's... can this be done....thanks!

View 1 Replies View Related

SQL Replace Apostrophe

Apr 18, 2000

Hello

Can anyone tell me how to replace a single apostrophe in a record with a double apostrophe (in Query Analyzer, SQL7)? I've tried "select replace("d'","d'","d''")FROM RESORT" but it doesn't UPDATE the table.

Suggestions gratefully received!

Mark

View 1 Replies View Related

Apostrophe Usage

Jun 14, 2004

Ok, I still have some uncertainty as to just exactly how this whole apostrophe thing works with databases. I understand that it is a reserved character and so when a sql query runs into one of these creatures it looks at it as something other than a normal character.

I am working primarily in vb/asp/sql server with a little bit of access. I am familiar with the instrinsic 'Replace' function and I use it but I still have occassional problems.

I would like any information I can get on just exactly why/how this thing works and how to work-around the apostrophe when writing to, reading from, and validating data from sql server/access/any databases.

Thanks!

View 1 Replies View Related

Problem With Apostrophe

May 7, 2007

I am having weird trouble with READING data from my Access database where the field has an apostrophe - but only when I display the field in a textbox.

For example, the field "Don't do this" becomes "Don" when my SQL query outputs the result:

campaignID = rscampaign("campaign")
response.write "<input type='hidden' name='campaignid1' value='" & campaignID & "'>"

If I output to regular HTML (e.g. in a <P> tag), the field displays correcly.



Has anyone ever encountered this problem? I can't figure out why the textbox would be creating this problem...

View 7 Replies View Related

Replace Apostrophe In SQL

Jun 5, 2007

replace(lastname," ' '",'"x"') (spaces for clarity only)



Result:

Invalid column name ' ' '.



How do I get around the invalid column name?



Thanks in advance for your assistance!

View 10 Replies View Related

Insert An Apostrophe Into A Sql String

Aug 17, 2007

Hey I have what I think is a simple question. How would i insert an apostrophe into a sql string without getting an error. Thanks in advance

View 5 Replies View Related

SqlDataSource : Dynamic SQL : Apostrophe

Sep 20, 2007

OK so I need to use a dynamic SQL statement in a SqlDataSource object because I need to pass in the column name.  I'm having trouble accounting for the apostophes I have to interpret literals within the statement.  This is connecting to an Oracle database.
This is what I originally tried...
<asp:SqlDataSource ID="SqlDataSourceMine" runat="server" ConnectionString="<%$ ConnectionStrings:My_Connection_String %>" ProviderName="<%$ ConnectionStrings:My_Connection_String.ProviderName %>" SelectCommand="SELECT m.YIE, :selecteditem, m.ENDTIME FROM MyMAP.MAP_M_SUM m WHERE (m.GROUPID LIKE 'YC%' AND m.GROUPID NOT LIKE 'YCX%' AND m.ENDTIME >= SYSDATE-14)">    <SelectParameters>        <asp:ControlParameter Name="selecteditem" ControlID="itemlabel" PropertyName="Text" Type="String" />    </SelectParameters></asp:SqlDataSource>
And the second column returned as :selecteditem for the column name and the value of itemlabel.text (what I wanted to be the column that was queried) as the value in each of the rows of that column.  So I tried dynamic SQL to put the value of itemlabel.txt as the column to be queried, but I'm not sure how to get the query to read the literals.  How can I accomplish this?
<asp:SqlDataSource ID="SqlDataSourceMine" runat="server" ConnectionString="<%$ ConnectionStrings:My_Connection_String %>" ProviderName="<%$ ConnectionStrings:MY_Connection_String.ProviderName %>" SelectCommand="EXEC('SELECT m.YIE, '+selectedbin+', m.ENDTIME FROM MMAP.MAP_M_SUM m WHERE (m.GROUPID LIKE '+paramlike+' AND m.GROUPID NOT LIKE '+paramnotlike+' AND m.ENDTIME >= SYSDATE-14)')">    <SelectParameters>        <asp:ControlParameter Name="selectedbin" ControlID="binlabel" PropertyName="Text" Type="String" />        <asp:ControlParameter Name="paramlike" ControlID="Label1" PropertyName="Text" Type="String" />        <asp:ControlParameter Name="paramnotlike" ControlID="Label2" PropertyName="Text" Type="String" />    </SelectParameters></asp:SqlDataSource>
This errors to "illegal variable name"
Can someone help me out please?  Thanks a lot.
-steve

View 3 Replies View Related

Problem Inserting Name With Apostrophe

Jan 23, 2008

Hi all,I am not sure this question will belong to a sql group or .net.but the problem I have is, my data entry forms crashes when some enter a apostrophe character in one of the field. that field is of type varchar in sql server 2000.for ex, Ryan O'neill will crash the application.
I have a drop down list of all my crew names in my form.what should I need to do to allow user to add apostrophe and not to have application crash?Please help it is very urgent.Thank You,

View 1 Replies View Related

Add Apostrophe To Column In Result Set

Feb 5, 2004

I have a brain teaser for you all.

The end result: I need one of the columns in my result set (col2) to have a preceeding apostrophe (i.e., '001234 ).

The problem: I am building my query as a string and then using the EXEC() function to execute it. For example:
SET @strSQL = 'SELECT col1, col2 FROM mytable'
EXEC(@strSQL)

Just to tame any answers that might not be directed to the specific question, the query Must be built as a string and then executed.

I have been unable to obtain the solution and I am wondering if it is even possible?

TIA

View 3 Replies View Related

Adding Apostrophe In A String

Mar 8, 2000

I would like to add an apostrophe in a string. eg. The boy's shoes.
Everytime I insert the record, the apostrophe gets drop. eg. The boys shoes.

Any suggestions??

Thanks, Vic

View 2 Replies View Related

How To Insert Text That Contains An Apostrophe??

Sep 4, 2004

Hi there,

I have an access 2000 db and in one of my tables I need to store some text that sometimes contains an apostrophe.

My problem is, everytime my program tries to insert text containing an apostrophe, the program crashes...

The insert statments I am using look like this:

CurrentDb.Execute "INSERT INTO myTable (Text) VALUES ('" & stringContainingApostrophe & "')"

I've tried checking the text for apostrophes and replacing them with an ecape character + apostrophe ("'") but that doesn't work either...

It seems like I should be able to store text that contains an apostrophe... Am i missing something here?

Does anyone have any ideas?? (Thanks in advance)

View 1 Replies View Related

Escaping An Apostrophe In MSSQL

Nov 10, 2006

Hi, i'm having problems executing the followingSET @SQLAH = 'SELECT sub_id WHERE 'SET @SQLAH = @SQLAH + 'VENUE_TYPE = Hotel'EXEC(@SQLAH)Its getting stuck at Hotel. I realise that it should include an apostrophe either side like so:..SET @SQLAH = @SQLAH + 'VENUE_TYPE = 'Hotel' '..But this escapes the string, how would i escape an apostrophe in a string?I thought maybe:SET @SQLAH = @SQLAH + 'VENUE_TYPE = 'Hotel' 'But no joy :confused: Thanks

View 4 Replies View Related

Pulling Data With Apostrophe

Aug 6, 2013

I am having a problem trying to pull data that has apostrophe in them. How can I do this? I get this as an error

Msg 105, Level 15, State 1, Line 14
Unclosed quotation mark after the character string ''.

Select
Name
From Table
Where Name IN (CHILDREN'S ANES ASSOCS-CHOP,CHILDREN'S HEALTHCARE-CHOP,CHILDREN'S PSYCH ASSOC-CHOP,CHILDREN'S SURGICAL ASSOC-CHOP)

View 4 Replies View Related

Find Field That Has Apostrophe

Nov 15, 2006

Getting an error when i execute the query.
select * from trio where ad_str1 like '%''


Server: Msg 105, Level 15, State 1, Line 1
Unclosed quotation mark before the character string '%'
'.
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near '%'
'.

View 1 Replies View Related

Apostrophe In The Middle Dilemma

Nov 16, 2007

How do you get the following to work properly?

WHERE Location = 'John's House'

The apostrophe between n and s has me stumped. Thanks.



View 6 Replies View Related

Replace A Caracter Like Apostrophe

Mar 19, 2008



Hai,

In my datedabase I have some customers with the next name: 't Woud.

The problem is the apostrophe in my query for my drill through.

This is my query:

SELECT DISTINCT c.alias AS Client, p.Alias AS Periode, u.alias as Product, v.alias as Verschil, CAST(s.indicatie AS decimal(6, 2)) AS Indicatie, CAST(s.realisatie AS decimal(6, 2)) AS Realisatie, CAST(s.real_indic AS decimal(6, 2)) AS [Realisatie -/- Indicatie], CAST(s.indicatie_fin AS decimal(6,0)) AS [Indicatie Fin], CAST(s.realisatie_fin AS decimal(6,0)) AS [Realisatie Fin], CAST(s.real_indic_fin AS decimal(6,0)) AS [Realisatie -/- Indicatie Fin]
FROM [BI_TZR].dbo.fact_clientsignaal s INNER JOIN
[BI_TZR].dbo.dim_verschil v ON s.verschil = v.verschil INNER JOIN
[BI_TZR].dbo.Dim_Periodewk p ON s.periode = p.Periode INNER JOIN
[BI_TZR].dbo.dim_client_uren c ON s.client_id = c.id INNER JOIN
[BI_TZR].dbo.dim_product u ON s.product = u.product
WHERE (LEFT(p.Alias, 1) = 'p') AND (c.alias like '%794735%') and s.kplts <> '1583'
ORDER BY s.product, s.periode

I try this:
SELECT DISTINCT replace ( c.alias, 'd', '') AS Client, this works, for the caracter D. But know I want it for the caracter apostrophe.

Can someone help me??

TNX

View 8 Replies View Related

How Can I Insert ' (Apostrophe) Into Sql Table Field ?

May 30, 2007

How can I insert ' (Apostrophe) into sql table field ?
Insert Into Table(Field) Values(?)
After executing sql statement above, I want to see ' (apostrope) in field.
Thanks

View 3 Replies View Related

Replace Function: Replacing An Apostrophe With Whatever

Aug 7, 2007

heyi'm having a problem with a stored procedure, to cut a long story short i need to replace apostrophe's in my text, like soSET @prOtherValue = REPLACE(@prOtherValue,''', '''')this doesn't work thowhats the work aroundcheers!!!! 

View 6 Replies View Related

VB - Stored Procedure - Apostrophe Issue

Sep 30, 2002

Hello,
I'm using Visual Basic 6 to insert data into SQL Server 2000 via a stored procedure. Apostrophes are giving me problems. Using T-SQL it works fine.

Following is the code:
=======================
cn.ConnectionString = "Driver=" & cnDriver & ";Server=" & cnServer & ";Database=" & cnDatabase & ";UID=" & cnUID & ";PWD=" & cnPWD
cn.Open

'TURNING QUOTES OFF allows a literal string to be delimited by double quotes and to accept an apostrophe
'cn.Execute "SET QUOTED_IDENTIFIER OFF" (This works using T-SQL statements only)

'set the reference to the ADO Command object
Set cmd = New ADODB.Command

'Set the command object properties
Set cmd.ActiveConnection = cn

pDocClass = "Apostrophe's test"

'THIS STORED PROC. INSERTS DATA INTO THE 'INDEX_DTL' AND 'CSC_TRANS' TABLES
cmd.CommandText = "Insert_Email_Data ('" & pDocID & "', '" & pLoginID & "', '" & pCustNum & "', '" & pDocClass & _
"', '" & pJCIRepCode & "', '" & pInitiallyRoute & "','" & pDocRecDate & "', '" & _
pCustPONum & "', '" & pJCIOdrNum & "', '" & strDateTime & "', '" & strTime & "', '" & _
strEmailDate & "', '" & strEmailTime & "', '" & strBatchCreationID & "', '" & _
"X" & "', '" & strEventType & "')"

MsgBox cmd.CommandText

cmd.CommandType = adCmdStoredProc
cmd.Execute
=======================

The above works great as long as the pDocClass field does not contain an apostrophe. In the stored procedure, pDocClass is defined as @pDocClass char (40).
Following is the error I receive:
"Line 1: Incorrect syntax near '{'

Any help with handling an apostrophe in the CommandText above would be greatly appreciated!

Thanks,
aml

View 2 Replies View Related

Using Single Apostrophe While Inserting Data

Mar 16, 1999

Dear fellows,

I want to insert the data in a field which contains apostrophe['] in it, but the insert command does not stores the test after apostrophe

e.g
Insert into test_tbl(id,name)
values (32,'This is a test of apostrophe's ...');

the above command does not store after first apostrophe.

Please suggest
-Faisal

View 2 Replies View Related

Syntax To Include Apostrophe In Sql Insert

Aug 12, 2004

I have a insert statement but one of the strings contains a apostrophe. If I leave the apostrophe in an error occurs becuase it thinks that it is the end of the string. What is the proper syntax for including apostrophes in a string?

Thanks.

View 8 Replies View Related

Replace A Single Apostrophe With Double - In Sql

Aug 22, 2007

I have the following:

-----------------



WHILE PATINDEX('%,%',@Columns)<> 0 BEGIN
SELECT @Separator_position = PATINDEX('%,%',@Columns)
SELECT @array_Value = LEFT(@Columns, @separator_position - 1)
SET @FieldTypeID = (SELECT FieldTypeID FROM [Form].[Fields] WHERE FieldID = (CAST(@array_Value AS INT)))
SET @FieldName = (SELECT [Name] FROM [Form].[Fields] WHERE FieldID = @array_Value)
print 'arry value' + CONVERT(VarChar(500), @array_value)
print 'FieldTypeID: ' + CONVERT(VARCHAR(500), @FieldTypeID)
PRINT 'FieldName: ' + @FieldName

BEGIN
IF @FieldTypeID = 1 OR @FieldTypeID = 2 OR @FieldTypeID = 3 OR @FieldTypeID = 9 OR @FieldTypeID = 10 OR @FieldTypeID = 7
BEGIN
SET @InnerItemSelect = ' (SELECT ISNULL(CONVERT(VARCHAR(MAX),[Value]),'''') FROM [Item].[ItemDetailFieldRecords] IDFR WHERE IDFR.ItemDetailID = ID.ItemDetailID AND IDFR.FieldID = ' + @array_Value + ') AS ''' + @FieldName + ''' '
SET @InnerTaskSelect = ' (SELECT ISNULL(CONVERT(VARCHAR(MAX),[Value]),'''') FROM [Item].[TaskFieldRecords] TFR WHERE TFR.TaskID = T.TaskID AND TFR.FieldID = ' + @array_Value + ') AS ''' + @FieldName + ''' '
END
ELSE IF @FieldTypeID = 4 OR @FieldTypeID = 8 --DropDownList/RadioButtonlist
BEGIN
SET @InnerItemSelect = ' (SELECT [Value] FROM [Form].[FieldListValues] FFLV INNER JOIN [Item].[ItemDetailFieldListRecords] IDFLR ON FFLV.FieldListValueID = IDFLR.FieldListValueID WHERE IDFLR.ItemDetailID = ID.ItemDetailID AND FFLV.FIeldID = ' + @array_value + ') AS ''' + @FieldName + ''' '
SET @InnerTaskSelect = ' (SELECT [Value] FROM [Form].[FieldListValues] FFLV INNER JOIN [Item].[TaskFieldListRecords] TFLR ON FFLV.FieldListValueID = TFLR.FieldListValueID WHERE TFLR.TaskID = T.TaskID AND FFLV.FIeldID = ' + @array_value + ') AS ''' + @FieldName + ''' '
END
ELSE IF @FieldTypeiD = 5 --Cascading
BEGIN
SET @InnerItemSelect = ' (SELECT [FCV].[Value] FROM [Form].[FieldCascadingValues] FCV INNER JOIN [Form].[FieldCascadingLookUpTables] LT ON FCV.FIeldCascadingLookupTableID = LT.FieldCascadingLookupTableID INNER JOIN [Item].[ItemDetailFieldCascadingRecords] IDFCR ON IDFCR.FieldCascadingValueID = FCV.FieldCascadingValueID WHERE IDFCR.ItemDetailID = ID.ItemDetailID AND LT.FieldID = ' + @array_value + ') AS ''' + @FieldName + ''' '
SET @InnerTaskSelect = ' (SELECT [FCV].[Value] FROM [Form].[FieldCascadingValues] FCV INNER JOIN [Form].[FieldCascadingLookUpTables] LT ON FCV.FIeldCascadingLookupTableID = LT.FieldCascadingLookupTableID INNER JOIN [Item].[TaskFieldCascadingRecords] TFCR ON TFCR.FieldCascadingValueID = FCV.FieldCascadingValueID WHERE TFCR.TaskID = T.TaskID AND LT.FieldID = ' + @array_value + ') AS ''' + @FieldName + ''' '
END
ELSE IF @FieldTypeiD = 6 --ListBox
BEGIN
SET @InnerItemSelect = ' (SELECT i.[CSV] FROM @ItemDetailLV i WHERE i.ID = ID.ItemDetailID AND i.FieldID = ' + @array_value + ') AS ''' + @FieldName + ''' '
SET @InnerTaskSelect = ' (SELECT it.[CSV] FROM @TaskLV it WHERE it.ID = T.TaskID AND it.FieldID = ' + @array_value + ') AS ''' + @FieldName + ''' '
END
ELSE IF @FieldTypeID = 11 --Users
BEGIN
SET @InnerItemSelect = ' (SELECT SU.[UserID] FROM [Security].[Users] SU INNER JOIN [Item].[ItemDetailUserRecords] IDUR ON SU.UserID = IDUR.UserID WHERE IDUR.ItemDetailID = ID.ItemDetailID AND IDUR.FieldID = ' + @array_value + ') AS ''' + @FieldName + ''' '
SET @InnerTaskSelect = ' (SELECT SU.[UserID] FROM [Security].[Users] SU INNER JOIN [Item].[TaskUserRecords] TUR ON SU.UserID = TUR.UserID WHERE TUR.TaskID = T.TaskID AND TUR.FieldID = ' + @array_value + ') AS ''' + @FieldName + ''' '
END
ELSE IF @FIelDTypeID = 12 --Group
BEGIN
SET @InnerItemSelect = ' (SELECT SG.[GroupID] FROM [Security].[Groups] SG INNER JOIN [Item].[ItemDetailGroupRecords] IDGR ON SG.GroupID = IDGR.GroupID WHERE IDGR.ItemDetailID = ID.ItemDetailID AND IDGR.FieldID = ' + @array_value + ') AS ''' + @FieldName + ''' '
SET @InnerTaskSelect = ' (SELECT SG.[GroupID] FROM [Security].[Groups] SG INNER JOIN [Item].[TaskGroupRecords] TGR ON SG.GroupID = TGR.GroupID WHERE TGR.TaskID = T.TaskID AND TGR.FieldID = ' + @array_value + ') AS ''' + @FieldName + ''' '
END
END
PRINT 'Inner Item Select:' + @InnerItemSelect
PRINT 'Inner Task Select:' + @InnerTaskSelect
SET @IDSelect = @IDSelect + @InnerItemSelect + ', '
SET @TSelect = @TSelect + @InnerTaskSelect + ', '
SELECT @Columns = STUFF(@Columns, 1, @separator_position, '')

END



---------------

That is only part of a large query that writs a SQL Query to a column in a Database. That Query (in the column) is just ran normally so I don't need to compile it each time I want to run it.

THe problem I have is @FieldName might be: ryan's field.

That apostrophe is killing me because the SQL keeps it as ryan's field, not ryan''s field(note the 2 apostrophes). I cannot do: REPLACE(@FieldName, ''', '''') because it's not closing the apostrophes. Is there an escape character that I can use to say only one: ' ?

I tried:

DECLARE @t VARCHAR(500)
SET @t = (SELECT [Name] FROM [Form].[Fields] WHERE FieldID = 1)
print @t -- @t will print: Ryan's Field
PRINT QUOTENAME('' + @t + '', '''')

but that gives me: 'Ryan''s Field'

Any help would rock. If I make any changes to the way this field is input into the DataBase, I know I will need to do a lot of re-work in many spots. WHich is why i'm trying to solve this on the SQL side.

View 4 Replies View Related

Problem With Case Statement And An Apostrophe In The Value

Oct 24, 2007



How do you treat the data when there is an apostrophe?

Example:

Update Table
Set Field = (Select Case Field
When 'Owner's' Then 'Owned By'
Else Field
End)

View 1 Replies View Related

Apostrophe In Comment Confuses ADODB

Jun 5, 2007

We just encountered an odd failure in ADODB. If it gets an SQL query with a comment embedded in it, and the comment has an apostrophe as one of the characters, ADODB gets confused as it tries to plug in parameters for placeholders later in the query. For example:





SELECT id, name

FROM doc_type /* this won't work! */

WHERE name LIKE ?

If you take out the apostrophe ("this will not work!") or move the comment to follow the placeholder, the query works.

Is this a known bug (couldn't find it in the KB)?

Thanks,
Bob Kline

View 28 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved