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


ADVERTISEMENT

How To Include A Word With Apostrophe In Statement Without Getting Error Msg

Jul 17, 2013

How do you include a word with an apostrophe in an SQL in statement without getting an error msg? For example this syntax:

where provname1 IN ('Children's')

With that syntax above, I would get an error message.

View 4 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

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

'Include Clause' In Create Index Syntax

Mar 26, 2008

What is the equivalent for INCLUDE clause (in Create index syntax) in SQL Server 2000.
SQL Server 2005 will support Include clause in Create index syntax . How to attain it in SQL Server 2000

Example : I have below query executable in SQL Server 2005

CREATE INDEX Index_Name ON mytable(col1 ASC) INCLUDE (name,id);

What is the equivalent for the above query in SQL server 2000

Thanks ,
Sushma

View 1 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

Insert Syntax

Oct 21, 2007

Hi all

Execute insert normal insert script Insert Into () select * from...

I need to monitor how many record inserted in target table, anyone can help

View 6 Replies View Related

SQL INSERT Syntax Madness

May 14, 2008

Hello. I have the below INSERT statement in an application, which works fine. However, I can't figure out how to insert data into a new column. The new column is text3, and the text would be TextBox4.Text + / + TextBox5.Text + / + TextBox6.Text + / TextBox7.Text. Where the "/" is text and not an operator. Every syntax I try doesn't work. Any ideas would be appreciated! INSERT INTO table (updateTime, text4, text5, text6, text7, updateTime1) VALUES (getdate(), '" + this.TextBox4.Text + "', '" + this.TextBox5.Text + "', '" + this.TextBox6.Text + "', '" + this.TextBox7.Text + "', CONVERT(VARCHAR(19), GETDATE(), 120) + Space(2) ) 

View 5 Replies View Related

Insert Syntax Error

Mar 1, 2004

In SQL 7.0 SP3 , I am receiving this message....

Server: Msg 170, Level 15, State 1, Line 17
Line 17: Incorrect syntax near ')'.

When I try to execute this code from SQL Query Analyzer...

DECLARE @DPPNumberCursor INT
DECLARE DPPNumberCursor Cursor for Select PPAP_ID
from ppap
where ppap_cancel <> "1" and
ppap_close <> "1" and
projectonhold <> "1"

OPEN DPPNumberCursor

Fetch Next From DPPNumberCursor

INTO @dppnumbercursor

While @@Fetch_Status = 0
Begin
INSERT INTO APQPSubformTable (apqpsub_id)
Values (@dppnumbercursor)

Bsically, I want to insert the number held in @dppnumbercursor in the APQPSub_id field.

Any help would be appreciated.

View 10 Replies View Related

SQL Insert Help, Syntax Issues?

Mar 20, 2007

INSERT INTO Payment_Breakdown (Order_ID,Denomination,Card_Payment,Comms_Request,Comms_Approved) VALUES (99109760,FAILED_CARD,0,-cc826 -cu826 -mc540436503249096 -tr09 -an1900 -cd4444333322221111 -dat070319172240 -ed0801 -is5 -rfIVR991097600 -sc456 -sd0501 -x,-rc30 -tr09 -ms"BAD AMOUNT" -rfIVR991097600 -cd4444333322221111 -ed0801 -sd0501 -cnVISA -td03132329 -mc540436503249096 -st0007 -x)

The element in italics is the problem I suspect. It is a text string to be entered into the table. It is actually a variable, I have taken this from a log as it shows the value instead.

I get this error...
quote:(STMT SQL Info:SQLPrepare [ S1000] Code:-201, [DataDirect][ODBC SequeLink driver][ODBC Socket][DataDirect][ODBC FileMaker driver][FileMaker]Parse Error in SQL q:F) (0xffffffff)

I am assuming the problem lies in the inverted commas (") in the italic string, is this right? How can I get around this or will I have to code them out before they become a string value in the variable?

View 2 Replies View Related

Mssql: Insert Into Syntax

Aug 21, 2005

HelloCan anyone help me translate this from access so that it can work in mssql(i need to get next value, but cannot use identity as if row is deleted,another must get new next column number which would be same as deleted one)Access;INSERT INTO tableSELECT(IIF(code<>Null,MAX(code)+1,1) AS code,0 AS usercodeFROM tableI tried this in mssql but will not work:INSERT INTO tableSELECTCASEWHEN code IS NULL THEN 1ELSE MAX(code)+1ENDAS code,0 AS usercodeFROM table

View 14 Replies View Related

BULK INSERT SYNTAX

Dec 26, 2006

I am setting up a new database using a shopping cart SW, when I create the DB
using there script, I get the following error

Msg 102, Level 15, State 1, Line 3

Incorrect syntax near '('.

The line syntax is as follows.



BULK INSERT testDB.dbo.[Look-Weight] FROM 'C:Inetpubwwwroot estSQL-AdminLook-Weight.csv';

WITH (

DATAFILETYPE = 'char',

FIELDTERMINATOR = ','

)

GO

What is wrong???

View 1 Replies View Related

Insert Into Syntax Error

Mar 5, 2008

I have run into a problem with my instert satement that gives me a syntax error whenever i try and add an extra value to it.

This one works but



Code Snippet
string sqlString1 = "INSERT INTO QuoteHeader (QuoteHeaderID, CustomerID, EmployeeID) VALUES("
+ newOrderHeader
+ ",'" + custID
+ "','" + empID
+ "')";




add another value and I get a synax error And i'm not sure why.



Code Snippet
string sqlString1 = "INSERT INTO QuoteHeader (QuoteHeaderID, CustomerID, EmployeeID, Month) VALUES("
+ newOrderHeader
+ ",'" + custID
+ "','" + empID
+ "','" + textBox6.Text
+ "')";







Code Snippet
try
{

cmd = new OleDbCommand(sqlString1, connectCmd);
int rowsReturned = cmd.ExecuteNonQuery();
}
catch (Exception ex)
{

string s = ex.Message;
DisposeResources(ref oleDbDataAdapter, ref ds, ref connectFill, ref connectCmd, ref cmd);
return;
}

View 7 Replies View Related

Syntax Error On Insert Statement

Jan 11, 2007

Ok, the following four lines are four lines of code that I'm running, I'll post the code and then explain my issue:
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sqlCommand = New SQLCommand("INSERT INTO Bulk (Bulk_Run, Bulk_Totes, Bulk_Drums, Bulk_Boxes, Bulk_Bags, Bulk_Bins, Bulk_Crates) VALUES (" &amp; RunList(x,0) &amp; ", " &amp; Totes &amp; ", " &amp; Drums &amp; ", " &amp; Boxes &amp; ", " &amp; Bags &amp; ", " &amp; Bins &amp; ", " &amp; Crates &amp; ")", Connection)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sqlCommand.ExecuteNonQuery()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sqlCommand = New SQLCommand("INSERT INTO Presort (Presort_Run, Presort_Totes, Presort_Drums, Presort_Boxes, Presort_Bags, Presort_Bins, Presort_Crates) VALUES (" &amp; RunList(x,0) &amp; ", " &amp; Totes &amp; ", " &amp; Drums &amp; ", " &amp; Boxes &amp; ", " &amp; Bags &amp; ", " &amp; Bins &amp; ", " &amp; Crates &amp; ")", Connection)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sqlCommand.ExecuteNonQuery()
The two tables (Bulk & Presort) are <b>exactly</b> the same.  This includes columns, primary keys, IDs, and even permissions.  If I run the last two liens (the INSERT INTO Presort) then it works fine without error.  But whenever I run the first two lines (the INSERT INTO Bulk) I get the following error:
Incorrect syntax near the keyword 'Bulk'.
Anyone have any ideas, thanks

View 2 Replies View Related

SqlDataSource1.insert() Syntax Error!!!

Apr 12, 2007

I am so close to haveing the web page i want, but i hve a syntax error with the Public Function Insert() as Integer.
I see no reason for this
i will post the code below, any help will be appreciated
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" %>
<script runat="server">
Private Sub Submitdata(ByVal Source As Object, ByVal e As EventArgs)
SqlDataSource1.Insert()
End Sub ' Submitdata
</script>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
<asp:sqldatasource
id="SqlDataSource1"
runat="server"
connectionstring="<%$ ConnectionStrings:clientInfoConnectionString %>"
selectcommand="SELECT Client Name,Client Address FROM Clients"
insertcommand="INSERT INTO Clients (Client Name,Client Address) VALUES (@CName,@CAddress)">
<insertparameters>
<asp:formparameter name="CName" formfield="Namebox" />
<asp:formparameter name="CAddress" formfield="Addressbox" />
</insertparameters>
</asp:sqldatasource>
&nbsp;Name:<br />
<asp:TextBox ID="Namebox" runat="server" /><br />
 
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="Namebox"
ErrorMessage="Please Enter A Name"></asp:RequiredFieldValidator>
 
<br />Address:<br />
<asp:TextBox ID="Addressbox" runat="server" /><br />
 
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="Addressbox"
ErrorMessage="Please Enter An Address"></asp:RequiredFieldValidator>
 
<br /><asp:Button ID="Submitbtn" runat="server" Text="Submit" OnClick="InsertShipper" />
<br />
 
 
</asp:Content>
Thanks
The King

View 10 Replies View Related

Syntax Error On INSERT Statement

Dec 16, 2005

Here is my insert statement:  StringBuilder sb = new StringBuilder();            sb.Append("INSERT INTO patients_import_test ");        sb.Append("(Referral_Number,Referral_Date,FullName,Patient_ien,DOB,FMP,SSN_LastFour,Race_Id,PCM,Age) ");            sb.Append("VALUES(@rnum,@rdate,@fname,@patid,@birthDate,@fmp,@ssan,@race,@pcm,@age) ");            sb.Append("WHERE Referral_Number NOT IN ( SELECT Referral_Number FROM patients_import_test )");I'm getting an "Incorrect syntax near the keyword 'WHERE'".If I remove the WHERE clause the INSERT statement work fine.

View 3 Replies View Related

Insert Into @parm Syntax Problem

Sep 29, 1999

I am writing a stored procedure:
CREATE PROCEDURE rasp_FillDescrColumnNames
@TableNameD varchar(50),
@TableNameU varchar(50),
@TableUID int
--
--
AS
......

Insert into @TableNameD(ColumnName)
Select #TempColumnNames.Name
From #TempColumnNames

-----------------------------
I get "incorrect syntax near '@TableName'". (The input table does have a column called 'ColumnName'). How do you parametized an 'Insert Into' sql statement? I have tried a number of ways to no avail.
Thanks,
Judith

View 2 Replies View Related

Insert Query Syntax Error

Dec 14, 2006

I cannot identify where the syntax error is, please help.

INSERT INTO [Attendence/Activity Log] (ID Number, Date, Activity, Duration) VALUES ('39', '12/14/06', 'Health & Nutrition', '2')

View 1 Replies View Related

Proper Syntax For Bulk Insert?

Sep 28, 2004

Hi,

I'm working in vb.net and want to use a stored procedure to insert all employees from one db into my db. I can insert one by one, but I would like to get them all in without looping.

How would I do this? I've tried bulk insert, but I keep getting syntax errors; I've read the books online, but don't quite understand what they mean. I don't want to use DTS, should I?

Here is what I'm doing so far:

CREATE Procedure Insert_From_Personnel
@emp_num char(10),
@Frst_Name char(10),
@Last_Name char(10),
@DivisionID char (4)

as

INSERT into individual (IndividualID,FirstName,LastName,DivisionID)

VALUES (@emp_num,@Frst_Name,@Last_Name,@DivisionID)
GO

Thanks for any help,

View 14 Replies View Related

BULK INSERT Syntax For A Specific Example

Apr 2, 2008

Hi,

I have a DTS package which, apart from other steps, loads a text file to the SQL Server (2000) table. The problem is that I need to do it for at least 20 text files, may be more.
As far as I have no experience in parametrizing DTS packages, I suppose it will be easier for me to do it with BULK INSERT.

What would be an equivalent BULK INSERT syntax for this load
(parameters taken from the DTS package mentioned)?

---------------------------------------
load a text file: path/txtfile.txt
(txtfile.txt on the network drive)
to an SQL Server 2000 table: db1.dbo.table1

Select File Format:
- Delimited
- File type: ANSI
- Row delimiter: Comma
- Text qualifier: Double Quote
- First row has column names: NO

Specify Column Delimiter:
- Tab
---------------------------------------

Thanks
Katarina

View 3 Replies View Related

Bulk Insert - Incorrect Syntax

Sep 23, 2013

I just upsized my access backend and a few of my tables did not import data. I am trying to do a bulk insert and this is the code I am using:

"BULK INSERT [dbo].[invoices]"
Select ('VendorName, Invoice_Number, DueDate,Type_of_Invoice, Select_field, Invoice_Status, tday, discount, file_as, Invoice_amount, Date_Paid, check_number, apply_discount, amountpaid')
FROM 'A:Invoices2.csv'
;WITH
(
FIELDTERMINATOR = ',')',
ROWTERMINATOR = "n")',
GO

When I click on the execute button I get this message:

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'A:Invoices2.csv'.

View 3 Replies View Related

Incorrect Syntax In Insert Many Rows?

Feb 18, 2015

I create table with automatically generate the next ID.

create table #people
(id integer identity primary key not null,
name varchar(20),
surname varchar(30),
number Char(11)
);

and next I would like to add many lines

insert into #people (name, surname, number)
VALUES
('Anne', 'Ferguson', '123456789'),
('Eve', 'Atkinson', '234567891'),
('John', 'Smith','345678912');

and I've got:

Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ','.

This is something wrong with the row ('Anne...

I use sql MS server 2008

View 1 Replies View Related

Insert Into Statement Syntax Error

May 30, 2006

Hi,

I have a problem as shown below


Server Error in '/ys(Do Not Remove!!!)' Application.


Syntax error in INSERT INTO statement.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement.

Source Error:





Line 8: <Script runat="server">
Line 9: Private Sub InsertAuthorized(ByVal Source As Object, ByVal e As EventArgs)
Line 10: SqlDataSource1.Insert()
Line 11: End Sub ' InsertAuthorized
Line 12: </Script>
Source File: C:Documents and SettingsDream_AchieverDesktopys(Do Not Remove!!!)Authorizing.aspx Line: 10

Stack Trace:





[OleDbException (0x80040e14): Syntax error in INSERT INTO statement.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) +177
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) +194
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) +56
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) +105
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +88
System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +392
System.Web.UI.WebControls.SqlDataSourceView.ExecuteInsert(IDictionary values) +410
System.Web.UI.WebControls.SqlDataSource.Insert() +13
ASP.authorizing_aspx.InsertAuthorized(Object Source, EventArgs e) in C:Documents and SettingsDream_AchieverDesktopys(Do Not Remove!!!)Authorizing.aspx:10
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +75
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +97
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4919




And part of my program is as shown

<Script runat="server">

Private Sub InsertAuthorized(ByVal Source As Object, ByVal e As EventArgs)

SqlDataSource1.Insert()

End Sub ' InsertAuthorized

</Script>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DIP1ConnectionString %>" ProviderName="<%$ ConnectionStrings:DIP1ConnectionString.ProviderName %>"

InsertCommand="Insert Into Authorize (Army ID,Tag No,Vehicle ID,Vehicle Type,Prescribed Route,Start Time, End Time) VALUES (@ArmyID, @TagNo, @VehicleID, @VehicleType, @PrescribedRoute, @StartTime, @EndTime)">

<insertparameters>

<asp:formparameter name="ArmyID" formfield="ArmyID" />

<asp:formparameter name="TagNo" formfield="TagNo" />

<asp:formparameter name="VehicleID" formfield="VehicleID" />

<asp:formparameter name="VehicleType" formfield="VehicleType" />

<asp:formparameter name="PrescribedRoute" formfield="PrescribedRoute" />

<asp:formparameter name="StartTime" formfield="StartTime" />

<asp:formparameter name="EndTime" formfield="EndTime" />

</insertparameters>

</asp:SqlDataSource>



Anybody can help? thanks

View 1 Replies View Related

Syntax Error In INSERT INTO Statement.

Apr 7, 2008

Public DBString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Q:VoicenetRTS FolderRTS ChargesAccountscosting.mdb"
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
Dim connstring As New OleDbConnection(DBString)
connstring.Open()
Dim searchstring As String = "SELECT * FROM Costings1"
Dim da As New OleDbDataAdapter(searchstring, connstring)
Dim DS As New DataSet()
Dim dt As DataTable = DS.Tables("Costings1")
da.FillSchema(DS, SchemaType.Source, "Costings1")
da.Fill(DS, "Costings1")
Dim cb As New OleDbCommandBuilder(da)
da.InsertCommand = cb.GetInsertCommand
da.UpdateCommand = cb.GetUpdateCommand
Dim dr As DataRow = DS.Tables("Costings1").NewRow
dr("Key") = TextBox1.Text
dr("CODE") = TextBox2.Text
dr("Element") = TextBox3.Text
etc...
DS.Tables("Costings1").Rows.Add(dr)
da.Update(DS, "Costings1") <<<<<<<<<<<Syntax error in INSERT INTO statement.

There are no spaces in the field names.

View 9 Replies View Related

Insert Syntax When Passing Input Parameters

Dec 27, 2000

I'm trying something like this:

CREATE PROCEDURE Add_Junk @Dist char, @CheckNo int =null OUTPUT AS
Set NoCount On
BEGIN TRANSACTION
INSERT INTO Junk (Dist)
VALUES (@Dist)
COMMIT TRANSACTION
select @CheckNo=@@IDENTITY

If what I pass is "416" I only get the "4" in my database and nothing else.
I don't get an error message.
What is wrong with my syntax?

PS I'm using Microsoft SQL 7.0

View 2 Replies View Related

Insert, Conditions, 3 Tables, Syntax, Performance

Jun 13, 2004

The following code should insert into 3 tables based on conditions. There's something screwy in my syntax and I'm pretty new at this can anyone help with transforming this in terms of performance and being syntactically correct? Thanks a million!


CREATE PROCEDURE [insert_vwMusic]
(@Artist [nvarchar](50),
@Genre [nvarchar](50),
@NLink [nvarchar](50),
@Album[nvarchar](50),
@Song[nvarchar](50),
@ArtistID[nvarchar](50),
@AlbumID[nvarchar](50),
@SLink[nvarchar](50))

AS

DECLARE @NewArtistID VarChar(50),
DECLARE @NewAlbumID VarChar(50)

IF Not Exists (SELECT [Artist] FROM [integration].[dbo].[tblMusic_Artist] WHERE [Artist] = @Artist)
BEGIN
INSERT INTO [integration].[dbo].[tblMusic_Artist]
( [Artist],
[Genre],
[NLink])

VALUES
( @Artist,
@Genre,
@NLink)

SET @NewArtistID = @@IDENTITY

INSERT INTO [integration].[dbo].[tblMusic_Albums]
( [Album]

VALUES
( @Album)

SET @NewAlbumID = @@IDENTITY

INSERT INTO [integration].[dbo].[tblMusic_Song]
( [Song],
[ArtistID],
[AlbumID],
[SLink])

VALUES
( @Song,
@NewArtistID,
@NewAlbumID,
@SLink)
END

ELSE
BEGIN
IF Not Exists (SELECT [Album] FROM [integration].[dbo].[tblMusic_Album] WHERE [Album] = @Album)
BEGIN
INSERT INTO [integration].[dbo].[tblMusic_Albums]
( [Album]

VALUES
( @Album)

SET @NewAlbumID = @@IDENTITY
SET @NewArtistID = (SELECT [ID] FROM [integration].[dbo].[tblMusic_Artist] WHERE [Artist] = @Artist)

INSERT INTO [integration].[dbo].[tblMusic_Song]
( [Song],
[ArtistID],
[AlbumID],
[SLink])

VALUES
( @Song,
@NewArtistID,
@NewAlbumID,
@SLink)
END
END
ELSE
BEGIN
SET @NewAlbumID = (SELECT [ID] FROM [integration].[dbo].[tblMusic_Album] WHERE [Album] = @Album)
SET @NewArtistID = (SELECT [ID] FROM [integration].[dbo].[tblMusic_Artist] WHERE [Artist] = @Artist)

INSERT INTO [integration].[dbo].[tblMusic_Song]
( [Song],
[ArtistID],
[AlbumID],
[SLink])

VALUES
( @Song,
@NewArtistID,
@NewAlbumID,
@SLink)
END

GO

View 5 Replies View Related

Insert Records Using EXEC Syntax In Transact

Sep 14, 2004

Hi all,

I have to insert records using transact iin the stored procedure. I have some thing like:

DECLARE @Err varchar(100)
DECLARE insertQ varchar(1000)

SET @Err = 'Insertion data'

SET @insertQ =('INSERT INTO dbo.T_ERRORLOG (ERROR_DESCR) VALUES(' + @Err + ')')

EXEC insertQ

But it don't work. Can you help me to solve the problem plz?

Thanks a lot

TT

View 4 Replies View Related

Wat's The Syntax To Insert Unique Identifier Data?

Aug 9, 2006

May I know what does the syntax of inserting data into a field of type Unique Identifier look like?

[code]
INSERT INTO THAI_MK_MT_Log(GUID, Status) VALUES ('2331486348632', 'S')
[/code]

The "2331486348632" is to be inserted into a unique identifier field.
If i coded the insert statement as the above, I got an error saying that "Syntax error converting from a character string to uniqueidentifier".....

Can anyone help?

View 11 Replies View Related

System.Data.OleDb.OleDbException: Syntax Error In INSERT INTO Statement.

May 3, 2007

Hi All I'm having a bit of trouble with an sql statement being inserted into a database - here is the statement:  string sql1;
sql1 = "INSERT into Customer (Title, FirstName, FamilyName, Number, Road, Town,";
sql1 += " Postcode, Phone, DateOfBirth, email, PaymentAcctNo)";
sql1 += " VALUES (";
sql1 += "'" + TxtTitle.Text + "'," ;
sql1 += "'" + TxtForename.Text + "'," ;
sql1 += "'" + TxtSurname.Text + "'," ;
sql1 += "'" + TxtHouseNo.Text + "',";
sql1 += "'" + TxtRoad.Text + "',";
sql1 += "'" + TxtTown.Text + "',";
sql1 += "'" + TxtPostcode.Text + "',";
sql1 += "'" + TxtPhone.Text + "',";
sql1 += "'" + TxtDob.Text + "',";
sql1 += "'" + TxtEmail.Text + "',";
sql1 += "'" + TxtPayAcc.Text + "')"; Which generates a statement like:INSERT into Customer (Title, FirstName, FamilyName,
Number, Road, Town, Postcode, Phone, DateOfBirth, email, PaymentAcctNo) VALUES ('Mr','Test','Test','129','Test Road','Plymouth','PL5
1LL','07855786111','14/04/1930','mr@test.com','123456') I cannot for the life of me figure out what is wrong with this statement. I've ensured all the fields within the database have no validation (this is done within my ASP code) that would stop this statement being inserted. Line 158: dbCommand.Connection = conn;Line 159: conn.Open();Line 160: dbCommand.ExecuteNonQuery();Is the line that brings up the error - I presume this could be either an error in the statement or maybe some settings on the Database stopping the values being added. Any ideas which of this might be ? I'm not looking for someone to solve this for me, just a push in the right direction! Thanks! 

View 2 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

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 View Related







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