473,693 Members | 2,800 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unexpected SQL syntax error!

Neo
I posted this to microsoft.publi c.sqlserver.pro gramming, but no one
could answer my question. So I think it is a good place to re-post my
question here.

My question:

I found that if you do not include any effective SQL statement between
BEGIN/END block, SQL Server 2000 Query Analyzer will think it is an
error:

Server: Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'end'.

if 1=1
select getdate()
else
begin
--select 'ok'
end

Is this behavior a SQL standard or simply a M$ standard glitch?
Jul 20 '05 #1
5 9121
On 31 Aug 2003 22:41:51 -0700 in comp.databases. ms-sqlserver,
ne***********@m sn.com (Neo) wrote:
I posted this to microsoft.publi c.sqlserver.pro gramming, but no one
could answer my question. So I think it is a good place to re-post my
question here.

My question:

I found that if you do not include any effective SQL statement between
BEGIN/END block, SQL Server 2000 Query Analyzer will think it is an
error:

Server: Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'end'.

if 1=1
select getdate()
else
begin
--select 'ok'
end

Is this behavior a SQL standard or simply a M$ standard glitch?


From books online:
<--
Syntax
BEGIN
{ sql_statement | statement_block }
END

Arguments
{sql_statement | statement_block }
-->

Shows the argument is not optional. :-)

--
A)bort, R)etry, I)nfluence with large hammer.

(replace sithlord with trevor for email)
Jul 20 '05 #2
Neo
.......

Can anyone direct me to other newsgroups for this question?

ne***********@m sn.com (Neo) wrote in message news:<96******* *************** ****@posting.go ogle.com>...
I posted this to microsoft.publi c.sqlserver.pro gramming, but no one
could answer my question. So I think it is a good place to re-post my
question here.

My question:

I found that if you do not include any effective SQL statement between
BEGIN/END block, SQL Server 2000 Query Analyzer will think it is an
error:

Server: Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'end'.

if 1=1
select getdate()
else
begin
--select 'ok'
end

Is this behavior a SQL standard or simply a M$ standard glitch?

Jul 20 '05 #3
Was my answer not helpful?

SK

Neo wrote:
......

Can anyone direct me to other newsgroups for this question?

ne***********@m sn.com (Neo) wrote in message news:<96******* *************** ****@posting.go ogle.com>...
I posted this to microsoft.publi c.sqlserver.pro gramming, but no one
could answer my question. So I think it is a good place to re-post my
question here.

My question:

I found that if you do not include any effective SQL statement between
BEGIN/END block, SQL Server 2000 Query Analyzer will think it is an
error:

Server: Msg 156, Level 15, State 1, Line 6
Incorrect syntax near the keyword 'end'.

if 1=1
select getdate()
else
begin
--select 'ok'
end

Is this behavior a SQL standard or simply a M$ standard glitch?


Jul 20 '05 #4

"Neo" <ne***********@ msn.com> wrote in message
news:96******** *************** ***@posting.goo gle.com...
Is this behavior a SQL standard or simply a M$ standard glitch?


Having this message is not a bad thing as it tends to indicate that your
code is incorrect, rather than the opposite.

John
Jul 20 '05 #5
On Tue, 02 Sep 2003 11:36:27 GMT in comp.databases. ms-sqlserver, Steve
Kass <sk***@drew.edu > wrote:
Was my answer not helpful? Neo wrote:
......

Can anyone direct me to other newsgroups for this question?


or mine?

consider changing:

if @foo=1
set @bar = 2
else
set @bar = 3

to:
if @foo=1
set @bar = 2
else
-- set @bar = 3

you'd get the same sort of error, unless of course some more code
followed that bit in which case you'd just get unexpected results.

--
A)bort, R)etry, I)nfluence with large hammer.

(replace sithlord with trevor for email)
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4504
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by including the -q64 option in xlC compiler. And we are able to link all these libraries to one of the main applications and generate an executable. SKLoader. But, when we try to run this main executable, we are getting the following errors:
8
2810
by: Jim Michaels | last post by:
C:\prj\quiz\withusers>php tareports.php PHP Parse error: syntax error, unexpected T_ELSE in C:\prj\quiz\withusers\tareports.php on line 205 this is the section of code. if (isset($row4)) { if (isset($row5)) { //answer given? if ($row4==$row5) {
8
46188
by: Wescotte | last post by:
The error message Parse error: syntax error, unexpected $end in FILE on line X is one I run into frequently and I know the cause is I missed an ending quote. Is there an easy way to determine where the inital " started? I find myself adding /* */ blocks or cutting/pasting sections of code out in order to find where the error occured. Wouldn't it it be nice if the warning message included the line in teh source where the initial quote ...
4
22151
kestrel
by: kestrel | last post by:
I have some html code that is supposed to be displayed by php echo. But for some reason i keep getting a syntax error, and i cant figure out what is going on. Heres what i have <?php if(isset($_GET)) { echo "<div id="visible">"; echo "<span onclick="swapform()">Log In Form</span>"; echo "</div>"; echo "<div id="theform" style="visibility: hidden">";
1
1403
by: basswhizz | last post by:
Hi guys im having trouble with somethings else now can you help out thanks!! Im getting this error message Parse error: syntax error, unexpected $end Here's my code cheers!!] <?php // Connects to your Database mysql_connect("aldridge3", "root", "") or die(mysql_error()); mysql_select_db("dwalk96") or die(mysql_error());
36
7990
by: rhys | last post by:
My Gurus and Angels -- Please pardon this old-school programmer, only recently enlightened to open-source, having been trapped in the convenience of proprietary lingos for way too long. My shortcomings will soon become apparent. I am developing an estimating construction system, using PHP5 and MySQL 5.0.24a with Ubuntu. I have a main "projects" file, and 2 detail files, one for piping and one for equipment. Each of these files will have...
20
3153
by: Jim Michaels | last post by:
I have a 638 line glob of PHP code & HTML that won't run. I get "PHP Parse error: syntax error, unexpected '}' in quiz\\quiz.php on line 594". I wrote a brace checker that checks perens, square brackets, and curly braces for mismatches & opens and it checks out perfect. so I don't know what it is about the curly brace error. it's false. anybody have a clue as to what the real error might be? the code looks pristine to me. ...
3
6946
by: SilvaZodiac | last post by:
Hi everyone, I'm still rather new to PHP code, and I have a syntax error. I've tried several different solutions, but it won't fix. It seems to suggest that I need a new bracket somewhere in the offending line, but being amateur, I don't know where. I've tried putting one in several places, to no avail. Clearly, to solve this in a smaller period than a week I need someone with more skill to help out. Heh heh. The error is: Parse error:...
3
5594
paulrajj
by: paulrajj | last post by:
hi to all, i am getting syntax error on my code.. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\xampp\htdocs\Dummy\paulraj\matrim\exam.php on line 62 what's the actual problem here..? my code
10
5658
by: benicio | last post by:
Parse error: syntax error, unexpected T_STRING, expecting '(' in C:\wamp\www\study_group\includes\functions.php on line 19 I got this error and this syntax is from 8 to 19th line. <?php $subject_set = get_all_subjects(); while ($subject = mysql_fetch_array($subject_set)) { echo "<li>{$subject}</li>"; $page_set = get_pages_for_subject($subject);
0
8549
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9100
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8970
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8815
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8812
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6475
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5824
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2245
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1967
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.