EXEC and EXECUTE

  • Comments posted to this topic are about the item EXEC and EXECUTE

  • This was removed by the editor as SPAM

  • Yes, it was an easy one. I admit I was looking for the trick.

  • Ed Wagner (7/8/2016)


    Yes, it was an easy one. I admit I was looking for the trick.

    +1 😉

    Thanks Steve and happy weekend to all.

  • George Vobr (7/8/2016)


    Ed Wagner (7/8/2016)


    Yes, it was an easy one. I admit I was looking for the trick.

    +1 😉

    Thanks Steve and happy weekend to all.

    +1 Yes, I even checked BoL...

  • Ed Wagner (7/8/2016)


    Yes, it was an easy one. I admit I was looking for the trick.

    Me, too. I read it half a dozen times to make sure I wasn't missing something.

    Thanks, Steve.

  • Depends if you're talking about the EXEC() function or the EXEC abbreviated version of EXECUTE. As I recall the EXEC() function can't see any variables declared in the calling session because it executes in a separate session. EXEC/EXECUTE operate in the same session they are called in and can see those variables.

    There are no facts, only interpretations.
    Friedrich Nietzsche

  • Easy one. 😀

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Easy one (but I still ran this in SSMS to be safe 😛 : EXECUTE('SELECT 1');)

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • Revenant (7/8/2016)


    George Vobr (7/8/2016)


    Ed Wagner (7/8/2016)


    Yes, it was an easy one. I admit I was looking for the trick.

    +1 😉

    Thanks Steve and happy weekend to all.

    +1 Yes, I even checked BoL...

    Me too - I thought EXEC was an accepted way of writing EXECUTE and then thought "it can't be that easy", looked it up, and found it was that easy.

    Tom

  • TomThomson (7/13/2016)


    Revenant (7/8/2016)


    George Vobr (7/8/2016)


    Ed Wagner (7/8/2016)


    Yes, it was an easy one. I admit I was looking for the trick.

    +1 😉

    Thanks Steve and happy weekend to all.

    +1 Yes, I even checked BoL...

    Me too - I thought EXEC was an accepted way of writing EXECUTE and then thought "it can't be that easy", looked it up, and found it was that easy.

    I didn't look it up having seen it all over the place. IMHO there is a difference. It's all aesthetics and preference. I don't like seeing the shorthand version.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Knew the answer but not sure why there are 2 almost identical commands that do exactly the same thing

    - Damian

  • DamianC (11/15/2016)


    Knew the answer but not sure why there are 2 almost identical commands that do exactly the same thing

    Those are not 2 commands. It's one command and its short version. You can find different examples on this happening.

    CREATE PROC and CREATE PROCEDURE

    BEGIN TRAN and BEGIN TRANSACTION

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply