Showing posts with label syntax. Show all posts
Showing posts with label syntax. Show all posts

Wednesday, March 21, 2012

Mixing parameter syntax in Execute SQL task

Hi all,

As part of the logging process for data input, I want to update two fields in a logging table. The first is a datetime, derived from looking up the maximum value in another table (the table I've just imported), and the second is an integer - the number of rows captured in a variable during the task.

I can do this in two separate Execute SQL tasks as follows:

Task 1 syntax

DECLARE @.maxDate datetime
SELECT @.maxDate = max(dtLastChangedDate)
FROM dbo.tblCancel_RAW

UPDATE dbo.tblLogging
SET PreviousFilterValue = CurrentFilterValue,
CurrentFilterValue = ISNULL(CAST ( @.maxdate as varchar(25)),CurrentFilterValue),
DateSourceTableLastRead = GetDate(),
RowsReturned= -1
WHERE SourceTableName = 'cancel'

Task 2 Syntax, with the variable user::rowsimported mapped to parameter 0

UPDATE dbo.tblLogging
SET
RowsReturned= ?
WHERE SourceTableName = 'cancel'

However I cannot make this work with a single SQL statement such as

DECLARE @.maxDate datetime
SELECT @.maxDate = max(dtLastChangedDate)
FROM dbo.tblCancel_RAW

UPDATE dbo.tblLogging
SET PreviousFilterValue = CurrentFilterValue,
CurrentFilterValue = ISNULL(CAST ( @.maxdate as varchar(25)),CurrentFilterValue),
DateSourceTableLastRead = GetDate(),
RowsReturned= ?
WHERE SourceTableName = 'cancel'

because no matter how I try to map the parameter (0,1,2,3,4 etc) the task fails.

Is this behaviour by design, is it a bug, or is there something I've missed?

Thanks as ever,

Richard

Richard,

What error message do you get?

-Jamie

Wednesday, March 7, 2012

Missing Operators Error

I am getting the following error when trying to post data into SQL:
Description: Syntax error (missing operator) in query
Number: -2147217900 (0x80040E14)
Source: Microsoft JET Database Engine
I am using a custom query in FrontPage:
INSERT INTO Results (Name, Email, Comments, File) VALUES
('::Name::', '::Email::', '::Comments::', '::File::')
It looks ok to me but not sure why I am getting the above error. Any
ideas?The error message doesn't come from SQL Server. If you are using SQL Server as a back-end, you might
want to use Profiler to see what SQL is submitted to the database engine. In any event, you should
check this out in a group focused on either Jet or FrontPage (since these are the applications using
SQL Server in this case).
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
<bjorgenson@.charter.net> wrote in message
news:1142880890.534952.11320@.g10g2000cwb.googlegroups.com...
>I am getting the following error when trying to post data into SQL:
> Description: Syntax error (missing operator) in query
> Number: -2147217900 (0x80040E14)
> Source: Microsoft JET Database Engine
> I am using a custom query in FrontPage:
> INSERT INTO Results (Name, Email, Comments, File) VALUES
> ('::Name::', '::Email::', '::Comments::', '::File::')
> It looks ok to me but not sure why I am getting the above error. Any
> ideas?
>

Missing Operators Error

I am getting the following error when trying to post data into SQL:
Description: Syntax error (missing operator) in query
Number: -2147217900 (0x80040E14)
Source: Microsoft JET Database Engine
I am using a custom query in FrontPage:
INSERT INTO Results (Name, Email, Comments, File) VALUES
('::Name::', '::Email::', '::Comments::', '::File::')
It looks ok to me but not sure why I am getting the above error. Any
ideas?
The error message doesn't come from SQL Server. If you are using SQL Server as a back-end, you might
want to use Profiler to see what SQL is submitted to the database engine. In any event, you should
check this out in a group focused on either Jet or FrontPage (since these are the applications using
SQL Server in this case).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
<bjorgenson@.charter.net> wrote in message
news:1142880890.534952.11320@.g10g2000cwb.googlegro ups.com...
>I am getting the following error when trying to post data into SQL:
> Description: Syntax error (missing operator) in query
> Number: -2147217900 (0x80040E14)
> Source: Microsoft JET Database Engine
> I am using a custom query in FrontPage:
> INSERT INTO Results (Name, Email, Comments, File) VALUES
> ('::Name::', '::Email::', '::Comments::', '::File::')
> It looks ok to me but not sure why I am getting the above error. Any
> ideas?
>

Missing Operators Error

I am getting the following error when trying to post data into SQL:
Description: Syntax error (missing operator) in query
Number: -2147217900 (0x80040E14)
Source: Microsoft JET Database Engine
I am using a custom query in FrontPage:
INSERT INTO Results (Name, Email, Comments, File) VALUES
('::Name::', '::Email::', '::Comments::', '::File::')
It looks ok to me but not sure why I am getting the above error. Any
ideas?The error message doesn't come from SQL Server. If you are using SQL Server
as a back-end, you might
want to use Profiler to see what SQL is submitted to the database engine. In
any event, you should
check this out in a group focused on either Jet or FrontPage (since these ar
e the applications using
SQL Server in this case).
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
<bjorgenson@.charter.net> wrote in message
news:1142880890.534952.11320@.g10g2000cwb.googlegroups.com...
>I am getting the following error when trying to post data into SQL:
> Description: Syntax error (missing operator) in query
> Number: -2147217900 (0x80040E14)
> Source: Microsoft JET Database Engine
> I am using a custom query in FrontPage:
> INSERT INTO Results (Name, Email, Comments, File) VALUES
> ('::Name::', '::Email::', '::Comments::', '::File::')
> It looks ok to me but not sure why I am getting the above error. Any
> ideas?
>