I am using microsofts jdbc driver and I am trying to call a stored
procedure to get a resultset from SQL Server.
Usually this works fine when I select something from an ordinary table
but when I am involving a temp table in the final select statement I
do not get any resultset in return?
Lars wrote:
> I am using microsofts jdbc driver and I am trying to call a stored
> procedure to get a resultset from SQL Server.
> Usually this works fine when I select something from an ordinary table
> but when I am involving a temp table in the final select statement I
> do not get any resultset in return?
I believe the result set *does* come back, but your other stuff in the
procedure before the final select will also be returning update counts etc,
so you need to loop to handle all the update counts as well, before
getResultSet() will find the returned data.
Joe Weinstein at BEA
Showing posts with label proc. Show all posts
Showing posts with label proc. Show all posts
Saturday, February 25, 2012
Sunday, February 19, 2012
"Invalid Character value for cast specification" from VC++ when i execute a proc
Hi Everybody,
I have a question regarding the running of a procedure from VC++ in SQL server.
well this is the scenario.
i have a procedure in SQL server and i am running that thru my VC++ code.
:eek:
i have a recordset class and i create an object of it and then do a obj.Open(). the procedure is fetching 24 records correctly in the query analyser and in my while(!(obj.IsEOF())) loop it gets the first record correctly but the moment it encounters obj.MoveNext(); it bombs and gives me the following error..
"Invalid Character value for cast specification ".
i don't know why this is happening
Thanks for you help.Somewhere in your Transact-SQL code you are trying to convert a character value to another datatype. My first guess would be DATETIME, next might be INT or another numeric datatype. This is usually either in a column you are returning or in a WHERE clause, but it can happen anywhere you can refer to a column.
-PatP|||BTW, since this actually appears to be a Transact-SQL problem, I'm moving the thread back to the Microsoft SQL forum.
-PatP
I have a question regarding the running of a procedure from VC++ in SQL server.
well this is the scenario.
i have a procedure in SQL server and i am running that thru my VC++ code.
:eek:
i have a recordset class and i create an object of it and then do a obj.Open(). the procedure is fetching 24 records correctly in the query analyser and in my while(!(obj.IsEOF())) loop it gets the first record correctly but the moment it encounters obj.MoveNext(); it bombs and gives me the following error..
"Invalid Character value for cast specification ".
i don't know why this is happening
Thanks for you help.Somewhere in your Transact-SQL code you are trying to convert a character value to another datatype. My first guess would be DATETIME, next might be INT or another numeric datatype. This is usually either in a column you are returning or in a WHERE clause, but it can happen anywhere you can refer to a column.
-PatP|||BTW, since this actually appears to be a Transact-SQL problem, I'm moving the thread back to the Microsoft SQL forum.
-PatP
Thursday, February 16, 2012
"Go" into comments
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, =C9tat 1, Proc=E9dure testdon, Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, =C9tat 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
DonaldThe problem is that your GO is *not* inside the comments. The client tool (Query Analyzer, OSQL or
what you are using) will see the GO and separate the batches. So, the first batch doesn't have an
end-comment. And the next batch doesn't have a start-comment.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, État 1, Procédure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, État 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald|||Correct, the GO is between the comment block...but as you have noticed it is
not treated properly. This works:
alter PROC testdon
AS
-- drop table setup
-- go
SELECT *
FROM MRP_SM_BALPL
It is easy to "multi comment" lines within SQL 2000 Query Analyzer. Simply
highlight the lines and hit Ctrl-Shift-C. Ctrl-Shift-R removes comments.
--
Keith
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, État 1, Procédure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, État 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald|||Because GO is a batch separator and is parsed PRIOR to the comment
delimiters. Try highlighting the code you want to comment and hitting
CTRL+SHIFT+C -- comment
CTRL+SHIFT+R -- remove comment
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, État 1, Procédure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, État 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald|||Hi Mister Aaron,
Thanks for the explanations,
But : those operation do not work with Query analyser version 7.00.623 :o(
CTRL+SHIFT+C -- comment
CTRL+SHIFT+R -- remove comment
Donald
>--Original Message--
>Because GO is a batch separator and is parsed PRIOR to the comment
>delimiters. Try highlighting the code you want to comment and hitting
>CTRL+SHIFT+C -- comment
>CTRL+SHIFT+R -- remove comment
>-- >http://www.aspfaq.com/
>(Reverse address to reply.)
>
>
>"Donald" <anonymous@.discussions.microsoft.com> wrote in message
>news:818101c495b5$833dc860$a601280a@.phx.gbl...
>Hi every one,
>Using SQL 7.0,
>Why do i get the following error when i run this :
>
>alter PROC testdon
>AS
>/*
>drop table setup
>go
>*/
>SELECT *
>FROM MRP_SM_BALPL
>error :
>Serveur : Msg 113, Niveau 15, =C9tat 1, Proc=E9dure testdon,
>Ligne 6
>Missing end comment mark '*/'.
>Serveur: Msg 170, Niveau 15, =C9tat 1, Ligne 1
>Line 1: Incorrect syntax near '*'.
>If i remove "Go", it works... :o\
>But it's into comments !
>Thanks !
>Donald
>
>.
>|||Also, Go is not a T-SQL keyword. It's just a batch separator that tools
like Query Analyzer understand. ie. you would never use "go" inside a
stored procedure.
--
David G.
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, =C9tat 1, Proc=E9dure testdon, Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, =C9tat 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
DonaldThe problem is that your GO is *not* inside the comments. The client tool (Query Analyzer, OSQL or
what you are using) will see the GO and separate the batches. So, the first batch doesn't have an
end-comment. And the next batch doesn't have a start-comment.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, État 1, Procédure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, État 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald|||Correct, the GO is between the comment block...but as you have noticed it is
not treated properly. This works:
alter PROC testdon
AS
-- drop table setup
-- go
SELECT *
FROM MRP_SM_BALPL
It is easy to "multi comment" lines within SQL 2000 Query Analyzer. Simply
highlight the lines and hit Ctrl-Shift-C. Ctrl-Shift-R removes comments.
--
Keith
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, État 1, Procédure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, État 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald|||Because GO is a batch separator and is parsed PRIOR to the comment
delimiters. Try highlighting the code you want to comment and hitting
CTRL+SHIFT+C -- comment
CTRL+SHIFT+R -- remove comment
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, État 1, Procédure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, État 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald|||Hi Mister Aaron,
Thanks for the explanations,
But : those operation do not work with Query analyser version 7.00.623 :o(
CTRL+SHIFT+C -- comment
CTRL+SHIFT+R -- remove comment
Donald
>--Original Message--
>Because GO is a batch separator and is parsed PRIOR to the comment
>delimiters. Try highlighting the code you want to comment and hitting
>CTRL+SHIFT+C -- comment
>CTRL+SHIFT+R -- remove comment
>-- >http://www.aspfaq.com/
>(Reverse address to reply.)
>
>
>"Donald" <anonymous@.discussions.microsoft.com> wrote in message
>news:818101c495b5$833dc860$a601280a@.phx.gbl...
>Hi every one,
>Using SQL 7.0,
>Why do i get the following error when i run this :
>
>alter PROC testdon
>AS
>/*
>drop table setup
>go
>*/
>SELECT *
>FROM MRP_SM_BALPL
>error :
>Serveur : Msg 113, Niveau 15, =C9tat 1, Proc=E9dure testdon,
>Ligne 6
>Missing end comment mark '*/'.
>Serveur: Msg 170, Niveau 15, =C9tat 1, Ligne 1
>Line 1: Incorrect syntax near '*'.
>If i remove "Go", it works... :o\
>But it's into comments !
>Thanks !
>Donald
>
>.
>|||Also, Go is not a T-SQL keyword. It's just a batch separator that tools
like Query Analyzer understand. ie. you would never use "go" inside a
stored procedure.
--
David G.
"Go" into comments
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :=20
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :=20
Serveur : Msg 113, Niveau 15, =C9tat 1, Proc=E9dure testdon,=20
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, =C9tat 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald
The problem is that your GO is *not* inside the comments. The client tool (Query Analyzer, OSQL or
what you are using) will see the GO and separate the batches. So, the first batch doesn't have an
end-comment. And the next batch doesn't have a start-comment.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, tat 1, Procdure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, tat 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald
|||Because GO is a batch separator and is parsed PRIOR to the comment
delimiters. Try highlighting the code you want to comment and hitting
CTRL+SHIFT+C -- comment
CTRL+SHIFT+R -- remove comment
http://www.aspfaq.com/
(Reverse address to reply.)
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, tat 1, Procdure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, tat 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald
|||Correct, the GO is between the comment block...but as you have noticed it is
not treated properly. This works:
alter PROC testdon
AS
-- drop table setup
-- go
SELECT *
FROM MRP_SM_BALPL
It is easy to "multi comment" lines within SQL 2000 Query Analyzer. Simply
highlight the lines and hit Ctrl-Shift-C. Ctrl-Shift-R removes comments.
Keith
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, tat 1, Procdure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, tat 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald
|||Hi Mister Aaron,
Thanks for the explanations,
But : those operation do not work with Query analyser=20
version 7.00.623 :o(
CTRL+SHIFT+C -- comment
CTRL+SHIFT+R -- remove comment
Donald=20
>--Original Message--
>Because GO is a batch separator and is parsed PRIOR to=20
the comment
>delimiters. Try highlighting the code you want to=20
comment and hitting
>CTRL+SHIFT+C -- comment
>CTRL+SHIFT+R -- remove comment
>--=20
>http://www.aspfaq.com/
>(Reverse address to reply.)
>
>
>"Donald" <anonymous@.discussions.microsoft.com> wrote in=20
message
>news:818101c495b5$833dc860$a601280a@.phx.gbl...
>Hi every one,
>Using SQL 7.0,
>Why do i get the following error when i run this :
>
>alter PROC testdon
>AS
>/*
>drop table setup
>go
>*/
>SELECT *
>FROM MRP_SM_BALPL
>error :
>Serveur : Msg 113, Niveau 15, =C9tat 1, Proc=E9dure testdon,
>Ligne 6
>Missing end comment mark '*/'.
>Serveur: Msg 170, Niveau 15, =C9tat 1, Ligne 1
>Line 1: Incorrect syntax near '*'.
>If i remove "Go", it works... :o\
>But it's into comments !
>Thanks !
>Donald
>
>.
>
|||Also, Go is not a T-SQL keyword. It's just a batch separator that tools
like Query Analyzer understand. ie. you would never use "go" inside a
stored procedure.
David G.
Using SQL 7.0,
Why do i get the following error when i run this :=20
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :=20
Serveur : Msg 113, Niveau 15, =C9tat 1, Proc=E9dure testdon,=20
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, =C9tat 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald
The problem is that your GO is *not* inside the comments. The client tool (Query Analyzer, OSQL or
what you are using) will see the GO and separate the batches. So, the first batch doesn't have an
end-comment. And the next batch doesn't have a start-comment.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, tat 1, Procdure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, tat 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald
|||Because GO is a batch separator and is parsed PRIOR to the comment
delimiters. Try highlighting the code you want to comment and hitting
CTRL+SHIFT+C -- comment
CTRL+SHIFT+R -- remove comment
http://www.aspfaq.com/
(Reverse address to reply.)
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, tat 1, Procdure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, tat 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald
|||Correct, the GO is between the comment block...but as you have noticed it is
not treated properly. This works:
alter PROC testdon
AS
-- drop table setup
-- go
SELECT *
FROM MRP_SM_BALPL
It is easy to "multi comment" lines within SQL 2000 Query Analyzer. Simply
highlight the lines and hit Ctrl-Shift-C. Ctrl-Shift-R removes comments.
Keith
"Donald" <anonymous@.discussions.microsoft.com> wrote in message
news:818101c495b5$833dc860$a601280a@.phx.gbl...
Hi every one,
Using SQL 7.0,
Why do i get the following error when i run this :
alter PROC testdon
AS
/*
drop table setup
go
*/
SELECT *
FROM MRP_SM_BALPL
error :
Serveur : Msg 113, Niveau 15, tat 1, Procdure testdon,
Ligne 6
Missing end comment mark '*/'.
Serveur: Msg 170, Niveau 15, tat 1, Ligne 1
Line 1: Incorrect syntax near '*'.
If i remove "Go", it works... :o\
But it's into comments !
Thanks !
Donald
|||Hi Mister Aaron,
Thanks for the explanations,
But : those operation do not work with Query analyser=20
version 7.00.623 :o(
CTRL+SHIFT+C -- comment
CTRL+SHIFT+R -- remove comment
Donald=20
>--Original Message--
>Because GO is a batch separator and is parsed PRIOR to=20
the comment
>delimiters. Try highlighting the code you want to=20
comment and hitting
>CTRL+SHIFT+C -- comment
>CTRL+SHIFT+R -- remove comment
>--=20
>http://www.aspfaq.com/
>(Reverse address to reply.)
>
>
>"Donald" <anonymous@.discussions.microsoft.com> wrote in=20
message
>news:818101c495b5$833dc860$a601280a@.phx.gbl...
>Hi every one,
>Using SQL 7.0,
>Why do i get the following error when i run this :
>
>alter PROC testdon
>AS
>/*
>drop table setup
>go
>*/
>SELECT *
>FROM MRP_SM_BALPL
>error :
>Serveur : Msg 113, Niveau 15, =C9tat 1, Proc=E9dure testdon,
>Ligne 6
>Missing end comment mark '*/'.
>Serveur: Msg 170, Niveau 15, =C9tat 1, Ligne 1
>Line 1: Incorrect syntax near '*'.
>If i remove "Go", it works... :o\
>But it's into comments !
>Thanks !
>Donald
>
>.
>
|||Also, Go is not a T-SQL keyword. It's just a batch separator that tools
like Query Analyzer understand. ie. you would never use "go" inside a
stored procedure.
David G.
Subscribe to:
Posts (Atom)
