开发者

Conditional IF in T-SQL Errors?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜