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

SQL Command Help


Friend helping me learn...

Asked... Am I right in my thoughts...

1)  If Exists(Select * tblOne) Begin
     Update tblOne set field1 = 'true'
     End

Problem is  Missing FROM on Select?

2)  Insert into tblOne value (true, not burned)
     Select @@ident
     Update tblTwo set mgr = yes, Qualified = yes

Problem is yes not defined ?  NOt really sure about intent, maybe a true?

3)  Declare @count int
     Select @count = Count(totalNum) from tblOne where cooked='Rare'
     If count = Begin
     Update tblOne set MgrFlag = 'true'
     End

Problem is If statement needs a condition  like   If count = 1 Begin

4)  Merge tblOne
     Using tblTwo
     On (tblOne.brand = tblTwo.brand)
     WHEN MATCHED
     Then Insert into tblOne values('true' , 'not burned')

Syntax correct but will insert put data in 1st 2 fields of the table?

Any help appreciated
0
Bob Bender
Asked:
Bob Bender
  • 2
1 Solution
 
Aaron TomoskySD-WAN SimplifiedCommented:
1- I agree

2)  declare@ident;
Select ident doesn't make sense

3- also @count
0
 
Bob BenderAuthor Commented:

Okay....  coupla small followups...

a)  What does the @@ mean  in declaring?

b)  will data in Insert put data in 1st 2 fields of the table, or do I have to define names of fields (or is it optional)?

Thanx
0
 
Aaron TomoskySD-WAN SimplifiedCommented:
I dont know

If you don't put field names it uses the first two fields.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

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