• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

snytax problem

I have a insert into statement that I want to add a if else statement in it..

parameter @ check bit

insert into tblsome  empname
...... if (check = true) give me the value of  as @empname else null ...

what is the snytax for that in tsql?
0
1jaws
Asked:
1jaws
  • 2
1 Solution
 
tim_csCommented:
CASE WHEN check = 1 THEN @empname ELSE NULL END
0
 
tim_csCommented:
Should be @check
0
 
1jawsAuthor Commented:
thank you
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now