开发者

Conditional IF in T-SQL Errors?

开发者 https://www.devze.com 2022-12-31 17:36 出处:网络
I have this stored procdure CREATE PROC dob.p_foobar ( @foo bit = NULL, @Bar bit = NULL ) AS IF @Foo == 1 BEGIN

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


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


No ==

IF @Foo = 1
BEGIN
    ...
END
0

精彩评论

暂无评论...
验证码 换一张
取 消