Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2003
    Posts
    45

    Unanswered: Macros in SQL Server

    How effective are macros in SQL server?
    If riding in a plane is flying, then riding in a boat must be swimming. To experience the element, get out of the vehicle. Skydive!

  2. #2
    Join Date
    Apr 2003
    Location
    Israel
    Posts
    81
    what are macros ?
    --
    kukuk

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    There are no macros in sql server. Use stored procedures instead, and they are very effective.

  4. #4
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    user defineded functions are also available. UDFs can return a table, inline or scalar result.
    Paul Young
    (Knowledge is power! Get some!)

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    User-defined functions are usefull, but they can only be used for returning data and can't change, create, or delete existing data. Procedures are the best format for automating tasks.

    blindman

  6. #6
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    Not all macros are used to change data!

    A function can change data in a table, remember that you can use the EXECUTE statment in a function.
    Paul Young
    (Knowledge is power! Get some!)

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You cannot use EXECUTE within a function to change data.

    From Books Online:
    "User-defined functions cannot be used to perform a set of actions that modify the global database state. "

    The database would choke if you invoked a function in a query against a table that could potentially simultaneously change data in the table.

    You'll get this message when you call the function:
    "Only functions and extended stored procedures can be executed from within a function."

    blindman
    Last edited by blindman; 07-01-03 at 15:26.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •