views:

30

answers:

2

I have this stored procdure

CREATE PROC dob.p_foobar
(
  @foo bit = NULL,
  @Bar bit = NULL
)

AS

IF @Foo == 1
BEGIN
   SELECT 'Hello, World'
END

When I parse, I get the error "Incorrect syntax near '='".

Please tell me what I'm doing wrong. I know it's something stupid, but I just can't figure it out.

Thank you

+1  A: 

No ==

IF @Foo = 1
BEGIN
    ...
END
uosɐſ
No `THEN` :) I regularly make that mistake myself :(
Thorarin
Mixing VB and SQL :D
Joe Philllips
+3  A: 

SQL uses a single equals sign (=), not a double equals sign (==)

Joe Philllips
I'm an idiot. Thank you.
RHPT
You are not an idiot. You're welcome.
Joe Philllips