RE: odbccommand cant interpret some /*xxx*/ comments



Mauro,

I have tried your query (creating stored procedure) with the API
SQLExecDirect in the driver "SQL Server". The problem doesn't reproduce.
So, i would like to first confirm whether you are using the driver
"sqlsrv32.dll" (released by Microsoft).

Which version of MDAC are you using?
Which OS are you using?
What is the file version and product version of "sqlsrv32.dll"?

Something worth trying:
- remove comment from stored procedure
- not to use multiple-line comments (code path may be different for
multiple-line comment and single-line comment)

Thanks,
Ming.
MDAC Team, Microsoft.



"Mauro SB" wrote:

Hi Pak, tnaks for anwser, finally i found the problem, it shows up if in the
comment i use the word "select". i tried with many sql reserverd words, but
only select trigers the problem. i cant put all the code because of my
company restrictions but i give you the following info about the
scenario(weird scenario):

db server is : Adaptive Server Enterprise/12.5.4/EBF 14921
ESD#7/P/RS6000/AIX 5.1/ase1254/2095/64-bit/FBO/Fri Oct 12 12:11:32 2007

the odbc driver used is the one of SQL server 7


connection info:

OdbcConnection conn = new OdbcConnection();
StringBuilder str = new StringBuilder();

str.Append("Driver={SQL Server};");
str.Append("Server=" + ServerIP + ",");
str.Append(ServerPort + ";Network=DBMSSOCN;");
str.Append("UID=" + User + ";");
str.Append("PWD=" + Password + ";");
str.Append("Database=" + DBName + ";");

portion of code of the sp creation:

/*************************************************************************
select
*************************************************************************/

CREATE procedure spPrueba2
as
BEgIN
.
.
.
.

thaht will throw:

ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect
syntax near the keyword 'BEgIN'.

if you replace the select word in the comment with any other word, it runs
smothly.

tnks in advance for your time!


"Pak-Ming Cheung [MSFT]" wrote:

I have tested your given SProc in ODBC Test (shipped inside MDAC SDK 2.8). I
found that there is no problem if i put your given command into SQLExecDirect.

So, could you give us the exact program that can reproduce the problem?

Thanks,
Ming.
MDAC Team, Microsoft.




"Mauro SB" wrote:

Hi,
does anybody knows why can an odbccommand throw a "incorrect syntax near
begin" when i try to execute something like this:

/********************
**sp description **
********************/
create procedure spSomething
@var int
as
begin
.
.
.
end

if i split the coment it works fine, but i need the comment :D
executing from query analyzer or alikes works fine!! but not with ODBC
tnks in advance!

.



Relevant Pages

  • Error 1203
    ... The stored procedure is executed shortly before this ... Nothing is written to the SQL Server log. ... This error indicates a bug in SQL Server. ... I can't reproduce this except in our database. ...
    (microsoft.public.sqlserver.server)
  • Re: How to get list of EventClasses in MSSQLServer2000
    ... statement inside a stored procedure has completed.') ... SQL Server statement or stored procedure.') ... Plan','Displays the plan tree of the Transact-SQL statement executed.') ... Login','Occurs when a SQL Server login is added or removed; ...
    (microsoft.public.sqlserver.security)
  • Re: Accessing FoxPro Free Table
    ... which the SQL Server service is running. ... account, ... > If you are creating a stored procedure and you want> to make sure that the procedure definition cannot be> viewed by other users, you can use the WITH ENCRYPTION> clause. ... The procedure definition is then stored in an> unreadable form. ...
    (microsoft.public.data.odbc)
  • Re: Problem with the Legacy ASP files and the Sql Server Express
    ... table, if another inserting occurs at the nearly exactly the same moment, ... SQL Server will pass it a default value. ... assume that you do have a connection that can reach SQL Server Express. ... unless your stored procedure has some thing that only works ...
    (microsoft.public.dotnet.framework.aspnet)
  • Stored procedure does not complete until result set is retrieved from ODBC
    ... I have a SQL Server Stored procedure that I am executing via ODBC. ... -- Start Code without cursor ...
    (microsoft.public.sqlserver.odbc)