Please Help: Error: Missing Semicolon (;) At End Of SQL Statement.

Apr 10, 2004

Hey





I am trying to retieve a value from teh database and add one to it, then update the database with thenew value before redirecting to a page.





I am recieving this error and don't know why, i have the following coed below.





Dim objReaderQ as OleDBDataReader





Dim strSQLRead As String


Dim objCmd As New OleDbCommand





strSQLRead ="Select Quantity from tblCart Where (Productid=" & intProdidHold & ") AND (Cartid='" & strCartid & "')"





objCmd = new OleDbCommand(strSQLRead, objConn)


objReaderQ = objCmd.ExecuteReader()





if objReaderQ.Read()


'update quantity by 1





Dim i as integer


i = objReaderQ("quantity")


i = i + 1





objReaderQ.Close()





Dim strSQLQuantity as String = "INSERT INTO tblCart (Quantity) VALUES (@quantity) WHERE (productid=" & intProdidHold & ") AND (Cartid='" & strCartid & "');"





Dim objCmdQuantity As New OleDbCommand(strSQLQuantity, objConn)





objCmdQuantity.Connection = objConn





objCmdQuantity.Parameters.Add("@quantity", OleDbType.VarChar, 255)


objCmdQuantity.Parameters("@quantity").Value = i





objCmdQuantity.ExecuteNonQuery() ' <--- Error Is Occuring On This Line





Response.Redirect("ViewBasket.aspx")





end if








I really can't see what is wrong as i have placed the semi colon it wanted at the end of the string.





Thanks you for your time





Chris

View 1 Replies


ADVERTISEMENT

Missing Semicolon (;) At End Of SQL Statement

Apr 27, 2005

Code:

<%@Language = "VBScript"%>
<%Option Explicit%>
<%
dim oRs,oConn,dateofleave,sql,uid

dateofleave = trim(request.querystring("leavedate"))

uid = trim(request.querystring("employeeID"))

set oConn = Server.CreateObject("ADODB.Connection")
oConn.Provider="Microsoft.Jet.OLEDB.4.0"
oConn.Open(Server.MapPath("test.mdb"))

set oRs = Server.CreateObject("ADODB.Recordset")
sql ="INSERT INTO test (dateofleave)"
sql = sql & "VALUES ('&dateofleave') WHERE employeeID=&uid"

set oRs = oConn.execute(sql)

%>



can someone help me with this error?
Microsoft JET Database Engine- Error '80040e14'

Missing semicolon ( at end of SQL statement.

/test/booking.asp, line 18

where line 18 is "set oRs = oConn.execute(sql)"

View 4 Replies View Related

How To Deal With:the Previous Statement Must Be Terminated With A Semicolon.

Apr 28, 2008



when I backup the SQL Server 2005 database ,always get prompt
Error description: [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'E'.
+48166A04.0004 [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
+48166A04.0004 [Microsoft][ODBC SQL Server Driver][SQL Server]The label 'E' has already been declared. Label names must be unique within a query batch or stored procedure.}

how to deal with it, thanks

View 5 Replies View Related

Error: COMMIT Or ROLLBACK TRANSACTION Statement Is Missing. Why?

Nov 13, 2007

Hello:
I am implimenting the creation of sequence numbers .I use an insert proc on a table that generates the numbers using an identity field:
procedure usp_createidentity

begin transaction

insert into [tblOrderNumber] with default values

rollback ' done so no records in this table

select @OrderNumber = scope_identity()

I call this from another proc that inserts values into my order table:


procedure usp_Insert @OrderNumber int
as

SET XACT_ABORT ON;

BEGIN TRY

BEGIN TRANSACTION


EXEC usp_GetNewOrderNumber @OrderNumber = @OrderNumber output
INSERT INTO [dbo].[tblOrder] ([OrderNumber]) values (@orderNumber) ' inserts value from other stored proc


COMMIT TRANSACTION

END TRY

BEGIN CATCH

if (XACT_STATE() = -1)

ROLLBACK TRANSACTION

else

if (XACT_STATE() = 1)

COMMIT TRANSACTION
END CATCH

Here is the problem. When I run usp_Insert I get the following: Error 266 Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 0.

This refers to the usp_GetNewOrderNumber that is called inside the other proc as shown above.

The problem does not happen if I put each statement in usp_Insert in its own try/catch. transaction statements.

Maybe it has something to do with the rollback call in the usp_getneworder.

What do I need to do to get rid of this. problem and still run these within one try/catch trans statement set.

Thanks

View 9 Replies View Related

Simple If Statement, What Am I Missing

Oct 13, 2007

Hi everyone and thank for taking the time to read, I am new to this forum and to SQL to.
I am taking a programmers course, i learned mainly C# for now, but i also know a bit of C and C++ and linux programming,
i am going through my SQL school book, (SQL Server 2000 design and implementation) and i am trying a simple IF statement. heres how it goes
DECLARE @P CHAR
SET @P=NULL

SELECT @P=Powerlck FROM vehicle
IF (@P=NULL)
PRINT 'got you'


powerlck is a collum taking char(1) which is either Null or 1.
there is five entry all but one is set to 1, null is the default

when i run this script, it does not print 'got you'

but if i run select * from vehicle
it will show one with <NULL> value.

what did i miss??

View 2 Replies View Related

Missing A Needed Using Statement But Not Sure Which One

Mar 31, 2006

I'm trying to get my feet wet with creating a Sql Server project within VS 2005 and I have the using statements below present but when I compile I get errors stating that SqlContext, SQLPipe, and SQLCommand do not exist in the current context. What am I missing? Under the references node I have 3 references present (System, System.Data, and System.XML). What am I missing?

TIA

using System;

using System.Data;

using System.Data.Sql;

using System.Data.SqlClient;

using System.Data.SqlTypes;

using Microsoft.SqlServer.Server;

View 4 Replies View Related

Can An Update Statement Be Used For Interpolating Missing Data?

Jul 23, 2005

Here is a small sample of data from a table of about 500 rows(Using MSSqlserver 2000)EntryTime Speed Gross Net------------------ ----- -----21:09:13.310 0 0 021:09:19.370 9000 NULL NULL21:09:21.310 NULL 95 NULL21:10:12.380 9000 NULL NULL21:10:24.310 NULL 253 NULL21:11:24.370 8000 NULL NULL21:11:27.310 NULL 410 NULL21:11:51.320 NULL 438 NULL21:11:51.490 NULL NULL 10After the first row, every row has only one value of the three.I would like to replace all the NULL values with calculatedinterpolations.I can do it w/ cursors or while loops.I could do it w/ VB (I think)Can this be done w/ an Update statement using self joins?What would be the best way?The value for speed can increase or decrease over time, but can neverbe < 0Net is always less than gross, and neither can go below 0.TIA for any helpful suggestions.Thanks,BM

View 9 Replies View Related

Missing Row In Simple Conditioned SELECT Statement

Nov 7, 2007

Hey there everyone,

I'm sure there's a good reason for this, I just have no idea what it is.

If I run a SELECT * statement on one of my tables, the result set is missing one of the records.

If I SELECT that specific row (by identifier or anything else really), it returns just fine.

Any kind of select (e.g. WHERE ID > X) fails to return that specific row.

Any idea why this might be happening?


Thanks in advance for any guidance!

View 4 Replies View Related

SQL Server 2012 :: Missing Months In A GROUP BY Statement

Jan 20, 2015

I am trying to get a count by product, month, year even if there are is no record for that particular month.

Current outcome:
Product Month Year Count
XYZ January 2014 20
XYZ February 2014 14
XYZ April 2014 34
...

Desired outcome:
Product Month Year Count
XYZ January 2014 20
XYZ February 2014 14
XYZ March 2014 0
XYZ April 2014 34
...

The join statement is simple:
Select Product, Month, Year, Count(*) As Count
From dbo.Products
Group By Product, Month, Year

I have also tried the following code and left joining it with my main query but the product is left out as is seen:

DECLARE @Start DATETIME, @End DATETIME;
SELECT @StartDate = '20140101', @EndDate = '20141231';
WITH dt(dt) AS
(
SELECT DATEADD(MONTH, n, DATEADD(MONTH, DATEDIFF(MONTH, 0, @Start), 0))
FROM ( SELECT TOP (DATEDIFF(MONTH, @Start, @End) + 1)
n = ROW_NUMBER() OVER (ORDER BY [object_id]) - 1
FROM sys.all_objects ORDER BY [object_id] ) AS n
)

2nd attempt:
Product Month Year Count
XYZ January 2014 20
XYZ February 2014 14
NULL March 2014 0
XYZ April 2014 34
...

What I want is this (as is shown above). Is this possible?

Desired outcome:
Product Month Year Count
XYZ January 2014 20
XYZ February 2014 14
XYZ March 2014 0
XYZ April 2014 34
...

View 7 Replies View Related

Data With Semicolon Delimiter

Apr 18, 2008

Hi all......

I have an issue

There are 2 tables... source and target...

Data from source goes into target table under same field...

ISSUE IS -

Data from 'n' no. of records from source table goes into a single record in the target table with delimiter being a semi colon (;)...
where(n >=2)...

For example - if the source table has 'src1', 'src2' and 'src3' as the data then target table will have a single record with semicolon as delimiter as 'src1;src2;src3'

How do we compare the data under this particular field now...

Do we have to use a if then loop for identifying when the ; ends in target data...

kindly help by giving a example...



Thanks,
Avi.

View 1 Replies View Related

SQL Server 2012 :: Capture Statement From Missing Join Predicate Event?

Jan 27, 2015

After monitoring using SQL profiler, i found that Missing join predicate event is happening a lot.

The problem is that profiler doesn't allow me to select the textdata to know which SQL statement is causing the issue.

I tried using the spid to check what's that process is running but the problem is that application is running many sqls so when i run

select PROGRAM_NAME,hostname,qt.text from sys.sysprocesses as sps1 CROSS APPLY sys.dm_exec_sql_text(sps1.sql_handle) AS qt
where spid=169

it gets me the SQL being run at that time not the one that causing the event.

View 3 Replies View Related

How Can I Insert A Semicolon As User Data?

Sep 27, 2005

I'm working with an existing program that crafts an insert statement
from user input.  The data is machine generated, though, and some
of it has semicolons.  How can I "escape" those semicolons so that
I can insert them into the database?  Does the ESCAPE key work
with the insert statement, too?  Can I just replace the ";" with
some other character(s) to escape it?  I'm not finding much in the
online help.  Thanks!

View 5 Replies View Related

Connection String Has Semicolon (;) - How On Earth Can I Get This Working?

Aug 3, 2007

Ok, here's my setup. I've got a named instance in a SQL 2000 cluster. I only have dbo rights on my database, because it is a shared infrastructure. Here's my current web.config connection string (the meat, anyway):
When I'm at the office, this is my connection string, pretty normal:
connectionString="Data Source=ServerNameInstanceName;Initial Catalog=blah..."
But, when I connect through the VPN, I can't just connect through the named instance - I have a specific port. This is where things get odd.
First, if I try to connect through SQL Server Management Studio (2005), i get nothing. If I try to connect using "ServerNameInstanceName, (comma) Port Number" it connects, but not to my instance. I get a seperate set of databases that I believe are in the default instance. So, I changed the comma to a semicolon (;) - and it still connected to the same thing - connected to the database, but to the wrong set of databases. So, on a whim, I tried plunking my string, which was now "ServerNameInstanceName;(semicolon) PortNumber" into the SQL 2000 Tools and it worked in both Query Analyzer and in Enterprise Manager. So, I thought, I'll just slam this into my connection string and all will be well. No. I can't use a semicolon in my connection string, and I can't find an escape character to use. Double semicolons don't work, a comma doesn't connect me properly, double colons don't work, the JDBC brackets don't work {} - so I'm at a loss. I'm out of ideas. I've set up aliases, and those don't work earlier.
I'm using ASP.net 2 with VB & C# and Visual Studio 2005 Professional. Thanks for any help anyone can give on this!

View 3 Replies View Related

Wants Help For Extracting Semicolon Seprated Names From A Record

Aug 30, 2007

Hello friends,
I am designing an ETL process in which I have a source column which contains names seprated by semicolon( i.e Rajat Kr Sharma;Mr Sammer;Mr Ravi;Mr Ankur Bhatnagar) in each row.
ETL process should create n records,one for each single name in destination table as n numbers of name apprear
in each row of source table.

The number of names can vary in each row of source table as per no. of delimited character semicolon.

So Can some one suggest me to lay out some plan and what controls of SSIS I should use?

Here I m giving the pictorial view of activity I'm trying to carryout.



Source Table Row
______________________________________________________________________
|Rajat Kr Sharma;Mr Sammer;Mr Ravi;Mr Ankur Bhatnagar |
|_____________________________________________________________________ |

Changes to Destination Table
______________________________________
|Rajat Kr Sharma |
|_____________________________________|
|Mr Sammer |
|_____________________________________|
|Mr Ravi |
|_____________________________________|
|Mr Mr Ankur Bhatnagar |
|_____________________________________|

View 3 Replies View Related

Full Text Search With Characters Such As Colon Or Semicolon

Jun 20, 2008

Hi, I'd like to know if there's a way to get sql server NOT to ignore the colon when performing a full text search (CONTAINS) for a string "sometext:". At this moment the query works, only the results are not narrowed to the ones containing the specified colon. I've read about this and I saw that these kind of characters (word breakers and stemmers) are ignored and want to know if there's a way to work around this (obviously performing well - so LIKE fails the test). Thanks

View 2 Replies View Related

Union Returns Duplicates - Semicolon Or Comma Not Removed

Jan 7, 2012

This SQL is meant to show the changes that will be made, when removing a selected user's email address from a batch.

However, when executed, each row is duplicated, and in the duplication, the semi-colon or comma isn't removed. For example, if I wanted to remove user "sam@mail.com"

The table results displayed would be:

Row 1:
BatchID: 50
ParamName:EmailTo
ParamValue: jack@mail.com;sam@mail.com;frank@mail.com
NewParamValue: jack@mail.com;frank@mail.com

Row 2:
BatchID: 50
ParamName:EmailTo
ParamValue: jack@mail.com;sam@mail.com;john@mail.com
NewParamValue: jack@mail.com;;frank@mail.com

Ideally, it should only display each row once, and not have the semicolon error. It seems to be a union error, because when I comment out the First and second union statements, it runs fine.

-- Delete email address from a.Batch

IF(@EmailAddress IS NOT NULL)
BEGIN
IF(LEN(@EmailAddress) > 0)
BEGIN
IF(@ShowOnly = 1)

[Code] ......

View 2 Replies View Related

SQL Server 2012 :: String Concatenation Using + Operator With Semicolon Delimiter

Dec 5, 2013

I have 8 fields - I have requirement to concatenate using '+' operator with semicolon delimiter but issues is in the

Output I get semicolons for the fields that are empty below is my code :

-------------
case
when [SLII Request Type] ='Job Posting' and [SmartLaborII Request Status] like 'Pending Approval (Level 4%'
and [New Extension or Replacement Audit Flag] like 'FLAG%'
then 'Reject – New, Extension, Replacement invalid entry' --'it is jp'
else ''
end as [ES Fully approved data 1],
case

[Code] ....

View 6 Replies View Related

Reporting Services :: Concatenate 24 Columns With Semicolon Delimited Into Single Column

Sep 17, 2015

How do i concatenate 24 columns with semicolon delimited into a single column without getting data conversion error ....

View 2 Replies View Related

SQL Server Agent Job Step Properties Window Loses Property Values Containing Semicolon (;)

May 16, 2007

Here's a weird one:



We are setting up a job for the SQL Server Agent via SSMS. The Job Step Type is SSIS.



In the Job Step Properties window, on the Set values tab, you can enter Values to override your package variables - normally all well and good.



However in this particular case, the variable Value contains semicolons ( - it is a Connection String for an ODBC driver. Eg: Driver={Client Access ODBC Driver (32-bit)};system=MYSERVER;...



The behaviour for this Value is weird:

If the Value is not surrounded with double quotes ("), the job fails with "The command line parameters are invalid."
If the Value is surrounded with double quotes ("), the job will run as intended. The catch is: that entry and any subsequent "Set Values" entries disappear next time the Job Step Properties window is opened.

This looks like a bug with the parsing of those strings by the Job Step Properties window?



Or am I missing something?



Mike

View 5 Replies View Related

Missing Operator Error

Aug 24, 2004

SHow me the correct way of doing this query please

strSQL = "INSERT INTO EmpSkill ([EmployeeNo]) VALUES ('"
strSQL = strSQL & TestArray(lngCount).EmpNo & "')

'Need to place this at then end
WHERE EmployeeName = & TestArray(lngCount).EmpName

Ive found out you cant use WHERE clauses with insert satements, so i am trying to use UPDATE

strSQL = "UPDATE EmpSkill SET EmployeeNo = " & TestArray(lngCount).EmpNo & " WHERE EmpoyeeName = " & TestArray(lngCount).EmpName

Getting missing operator in query expression 'EmployeeName = Karl Diggle'

View 3 Replies View Related

Missing Operator Error

May 4, 2005

Can anyone help me out with this statement. I am trying to insert data into table a from table b where table a and table b have three fields which are the same, and I keep getting a missing operator error. Thanks in advance.

Update test
SET officeaddress = b.address,
officeaddress2 = b.address2,
officecity = b.city,
officestate = b.state,
officezip = b.zip,
officephone = b.phone,
me = b.me,
ims = b.ims
FROM test a
INNER JOIN A751P b on b.firstname = a.firstname AND b.lastname = a.lastname AND b.state = a.state

View 12 Replies View Related

BCP Error - Missing Data

Jan 31, 2007

After loading the BCP files that are created during the trigger/reporting events I've noticed that the data in the table is missingrecords. I've also noticed that the missing records (records in thetable but not in the BCP out files) seem to occur in contiguousblocks. Since the complete set of records exists in the table, Iassume this points to an issue in the way the TableUpdate script/Triggers interact with the system. But i tried to take out the bcpprocedure, do test on trigger, then no data missing, So, I think theproblem is still on bcp part. Could you help me with that?CREATE TABLE [EventUpdate] ([id] [int] NOT NULL ,[eventid] [int] NOT NULL ,[sequenceid] [int] NOT NULL ,[UpdatePass] [int] NULL) ON [PRIMARY]GOcreate trigger trgEventUpdate on EventLog For Insert,Update asinsert into EventUpdate (id,eventid,sequenceid) select ins.id,ins.eventid,ins.sequenceid from inserted insbcp script:bcp "select a.* from w..eventlog a, w..eventupdate b wherea.eventid=b.eventid and a.sequenceid=b.sequenceid and b.eventid<>-1and b.sequenceid<>-1 and b.updatepass=1" queryout 30sec-%TFN_NOW%.wrk -U <userwithaccess-P <password-S doserver -f EventLog.fmtThanks in advance for your reply!

View 3 Replies View Related

Error 208, Missing Stats

Jul 20, 2005

Hi chapsJust been having my head messed with...I was running a trace capturing all errors and SQL. Had a bucket oferror 208's (invalid object name). Found the SQL that caused it - anSP.Ran the sp by hand, no messages come up - error 208 logged in thetrace.Couldn't work it out. Then noticed stats missing on one column.Created the stats manually - and suddenly the 208 error stops. Wtf?Is this predicted/expected behaviour? Just me being a noob?Thought I'd just share that. ta ;)SQL2k, sp3a, w2k server.

View 2 Replies View Related

Sp_MSins_... Missing Replication Error

Jan 21, 2004

While setting up replication to another server my other replications came with the error could not find sp_MSins_<destinationtabel>
Error number 2812.
Is there anyway I can rebuild this stored proceduire or what is the easiest way to start synchronizing again, I can't drop the destination database because the amount of data to replicate is too much

Regards

View 1 Replies View Related

Syntac Error (missing Operator)

Jul 20, 2005

Hi - I can get this to work in SQL Server - but when also trying to makethe application compatible with MS Access I get an error:Select tblfaqnetgroups.group_name from tblfaqnetrolesInner Join tblfaqnetgroups ON tblfaqnetroles.group_id =tblfaqnetgroups.group_idInner Join tblaccess ON tblfaqnetroles.user_id = tblaccess.user_idAND tblaccess.user_id = 1The error in Access is:Syntax error (missing operator) in query expression'tblfaqnetroles.group_id = tblfaqnetgroups.group_idInner Join tblaccess ON tblfaqnetroles.user_id = tblaccess.user_id'Any help would be much appreciated,*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 3 Replies View Related

Parameter Is Missing A Value Error Only When I Deploy

Sep 7, 2006

Report X passes all it's parameters to Report Y via a "jump to report". Report Y then populates a select box based on the parameters passed to it. The user selects one of these values and clicks "View Report". This works perfectly in the development environment. But when I deploy it to the server I keep getting an error when I click the link that jumps to Report Y.

Here's the error: "The 'B' parameter is missing a value"

The problem is.. I don't want to pass the B parameter to Report Y. I want the user to select this from a list. I'm very confused as to why this would work in the development envionment but not when deployed.

Any Ideas?

View 3 Replies View Related

Temp Table - Missing A Command, Error

Jun 22, 2007

Here I am creating a temp table with $ summations that I can later join with an employees table that I'm dumping into a flat file.

select

e.employee_no,
sum(p.fit) as sumfit,
sum(p.fica) - sum(p.medicare) as sumfica,
sum(p.medicare) as sumedic,
sum(p.fit_earnings) as pearnings,
sum(p.fit_earnings) as tearnings

into #earntable

from employees as e
left outer join pay_summary as p on e.employee_no =p.employee_no

where e.employee_no = 817 and
dateadd(d, 0, datediff(d, 0, p.dated)) between '20061231'and '20070401'

group by e.employee_no

select * from #earntable

When I go to look at the contents of the #earntable with the above select, I get this:

ODBC error 214 Procedure expects parameter '@handle' of type 'int'.
(42000)

The datatypes I'm trying to select into the temp table are all
numeric 12 except employee_no char 10.

What am I missing? A drop table statement?

View 6 Replies View Related

SQL Server Error Missing End Comment Mark

Jun 23, 2006

Hi,Is there anyone encountered this error before & how it is being resolved?[Microsoft][ODBC SQL Server Driver][SQL Server]Missing end comment mark '*/'The error pops-up when I was running a DTS Import/Export from a SQL server(source) to another SQL server (destination) residing on a differentmachine. I'm copying all tables, views, & stored procedures of a database.Thanks for any input.Regards,Maricel

View 1 Replies View Related

Error : Header Information Is Either Corrupted Or Missing.

Mar 3, 2006

My config :



1 computer with win2000, IIS, McAfee Virus Scan, and all I need to develope.



1 computer with VS2005.



When I try to make merge replication I have this Error :Header information is either corrupted or missing.



I search on the web and find some information like that error is cause by NIS (Norton Internet Security) but I dont have it.



I have another mobile software in VS 2003 and I don't have trouble whit im. It work perfectly but not in VS 2005.



I can access to the replication folder. I use sscesa20.dll.



Need help



thanks.

View 2 Replies View Related

Sql Server Mobile Error 25123 - Missing Dll

Oct 20, 2006

Hi, in my app I connect to and read from a Sql Mobile database numerous times. Eventually and inconsistently my app will no longer be able to access the database and a SqlCeException is returned with native error 25123. This error translates to: "A SQL Mobile DLL could not be loaded. Reinstall SQL Mobile. [ DLL Name = sqlceqp30.dll ]". I've seen similar (and unsolved) problems involving RDA/replication, but I am not using any of that in my program. It simply connects to database, queries and retrieves data, then closes the connection. I am properly disposing of all SqlCE objects.

I'm not sure what the error really means. Once the program gets this error it is never able to access the database again until the program is restarted. I am still able to connect to that database from the Query Analyizer even after the program gets the error and hasnt been restarted (meaning if the program tried again after the QA's success it will still have same error).

Common suggestions for the similar RDA error are to put the initializion at the beggining of the program. In my case the database connection will succeed several times before the error occurs.

anyone have similar issue where you are not using replication but get error 25123?

View 8 Replies View Related

Missing Error Message? No Description Found

Jun 18, 2007

Anyone know what causes this?

When trying to deploy a package using the deploy wizard, following error is received:
===================================Could not save the package "H:SSISRSlogRSExecutionLog_UpdateinDeploymentRSExecutionLog_Update.dtsx" to SQL Server "xxxxxxxxxxxxxxxxxxxxx". (Package Installation Wizard)===================================No description found------------------------------Program Location: at Microsoft.SqlServer.Dts.Runtime.Application.SaveToSqlServer(Package package, IDTSEvents events, String serverName, String serverUserName, String serverPassword) at Microsoft.SqlServer.Dts.Deployment.DtsInstaller.SavePackageToSqlServer(WizardInputs wizardInputs, String packagePassword, Boolean bUseSeverEncryption, String serverName, String userName, String password, String packageFilePath, List`1 configFileNames) at Microsoft.SqlServer.Dts.Deployment.DtsInstaller.InstallPackagesToSqlServer(WizardInputs wizardInputs)

View 1 Replies View Related

Case Statement Error In An Insert Statement

May 26, 2006

Hi All,
I've looked through the forum hoping I'm not the only one with this issue but alas, I have found nothing so I'm hoping someone out there will give me some assistance.
My problem is the case statement in my Insert Statement. My overall goal is to insert records from one table to another. But I need to be able to assign a specific value to the incoming data and thought the case statement would be the best way of doing it. I must be doing something wrong but I can't seem to see it.

Here is my code:
Insert into myTblA
(TblA_ID,
mycasefield =
case
when mycasefield = 1 then 99861
when mycasefield = 2 then 99862
when mycasefield = 3 then 99863
when mycasefield = 4 then 99864
when mycasefield = 5 then 99865
when mycasefield = 6 then 99866
when mycasefield = 7 then 99867
when mycasefield = 8 then 99868
when mycasefield = 9 then 99855
when mycasefield = 10 then 99839
end,
alt_min,
alt_max,
longitude,
latitude
(
Select MTB.LocationID
MTB.model_ID
MTB.elevation, --alt min
null, --alt max
MTB.longitude, --longitude
MTB.latitude --latitude
from MyTblB MTB
);

The error I'm getting is:
Incorrect syntax near '='.

I have tried various versions of the case statement based on examples I have found but nothing works.
I would greatly appreciate any assistance with this one. I've been smacking my head against the wall for awhile trying to find a solution.

View 10 Replies View Related

Syntax Error (missing Operator) In Query Expression

Jan 22, 2008

Hi, Please could someone assist - the above error occurs.  This is my code: Protected Sub btnReport_Click(ByVal sender As Object, ByVal e As System.EventArgs)        ' Response.Redirect("CrystalreportTEST_Print.aspx?C_id=" & ddlCompany.SelectedValue)        Dim myConnection As New OleDbConnection(connString)        Dim Str As String = "SELECT clientid,company FROM Client WHERE company =" & ddlCompany.SelectedItem.Text        Dim cmd As New OleDbCommand(Str, myConnection)        Dim ds As New DataSet        Dim da As New OleDbDataAdapter(cmd)        da.Fill(ds)        Label7.Text = ds.Tables(0).Rows(0).Item("clientid")        ' Response.Redirect("CrystalreportTEST_Print.aspx?C_id=" & ds.Tables(0).Rows(0).Item("clientid"))    End Sub  Thank you in advance 

View 1 Replies View Related







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