Creating custom functions for SQL Server

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Creating custom functions for SQL Server

    Is there a really good reference/tutorial on creating functions for SQL
    Server? One of the questions that I have is wether or not it is possible
    to create VBScript/VBA functions for SQL Server. I know that it is
    possible to create user defined T-SQL functions, however it appears that
    T-SQL is too limited for what I need to do.

    David C. Holley Guest

  2. Similar Questions and Discussions

    1. Problem with creating a Component and using existing functions
      Ok, I've got the MovieClip setup as a component, adding code to the #initclip pragma to declare the class and link it to the ID in the library...
    2. Templates, custom functions, mysql
      Hi list, I'm using TemplatePower (http://templatepower.codocad.com/) as my template engine. There will be multiple rows of results, and the data...
    3. Custom functions in lingo
      I am trying to create a simple function in lingo to go to different web pages when the function is called. the function will accept an argument as a...
    4. Creating a custom scrollbar? I got nothing.
      Hello everybody, I did a little research on this forum and took a peek at the director-online.com tutorial and still have been unable to find an...
    5. Using custom SQL functions to call either ms... or my... depending on server
      Hi again As I'm developing my site, i've come across a problem with the database use. While developing it I only have mySQL, but the final server...
  3. #2

    Default Re: Creating custom functions for SQL Server

    > to create VBScript/VBA functions for SQL Server. I know that it is
    > possible to create user defined T-SQL functions, however it appears that
    > T-SQL is too limited for what I need to do.
    Bwahahaha! That's funny. Maybe you could tell us what you need to do
    before assuming that T-SQL is too limited to do it.

    And no, BTW, you can't create SQL Server functions using VB/VBA. You can
    create user-defined functions using T-SQL, or you can created extended
    stored procedures using C++. You will be able to create procedures, UDTs,
    aggregates, etc. using VB.Net or C# in Yukon ... but note that they will not
    necessarily be doing things that T-SQL isn't capable of; more or less they
    will be adding techniques to do the same things in different ways (in some
    cases faster or with less code than T-SQL).

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)


    Aaron [SQL Server MVP] Guest

  4. #3

    Default Re: Creating custom functions for SQL Server

    Kinda like my truck is limited in that I can't use it as a boat?

    Stoopid truck! Stoopid Nissan!

    Bob Lehmann

    "David C. Holley" <DavidCHolley@netscape.net> wrote in message
    news:u3j6BBIYEHA.3716@TK2MSFTNGP10.phx.gbl...
    > Is there a really good reference/tutorial on creating functions for SQL
    > Server? One of the questions that I have is wether or not it is possible
    > to create VBScript/VBA functions for SQL Server. I know that it is
    > possible to create user defined T-SQL functions, however it appears that
    > T-SQL is too limited for what I need to do.
    >

    Bob Lehmann Guest

  5. #4

    Default Re: Creating custom functions for SQL Server

    Actually, in writing my initial response, I can distill the problem down
    to this...

    There are two tables - tblZones and tblRates. As records are added to
    tblZones a trigger will fire that will automatically insert records into
    tblFares. How would I create a WHERE statement to prevent duplicate
    records from being added into tblFares?

    The particular schema is neccessary because of a third table
    (tblLocations) that contains the records for the various specific
    locations. Basically you grab a location as the Origination, then grab
    another as the Destination and then look up the rate based on the zones
    that the ORG & DEST are in. Because of this tblRates needs to have two
    records for each combination of zones as in ...

    ORG DEST FARE
    1 1 $25
    1 2 $45
    1 3 $35
    2 1 $25
    3 1 $35

    Another twist on this is that tblRates will have a third column
    indicating product. So if there are two products the records would
    appear as

    PRODUCT ORG DEST FARE
    LTC 1 2 $25
    LTC 1 3 $45
    LTC 2 1 $25
    LTC 3 1 $45
    SLM 1 2 $25
    SLM 1 3 $45
    SLM 2 1 $25
    SLM 3 1 $45

    Hopefully, that explains everything.

    David

    tblLocations has a one to many relationship with tblRates

    A physical rep of the relationship between tblLocations & tblRates would
    be
    tblLocation -on Zone No-> tblRates <-on Zone No-tblLocation

    [url]www.gatewayorlando.com[/url]

    *** Sent via Devdex [url]http://www.devdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    David Holley Guest

  6. #5

    Default Re: Creating custom functions for SQL Server

    Actually, about an hour after I wrote that last response, the solution
    presented itself - abeit its a SQL statement that will probably be about
    a furlong in length. Haven't created it yet, but at least I know what
    direction to go. Will post back.

    David H

    [url]www.gatewayorlando.com[/url]

    *** Sent via Devdex [url]http://www.devdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    David Holley Guest

  7. #6

    Default Re: Creating custom functions for SQL Server

    I have created FIRE!!

    David H
    (The trigger is alive and working nicely.)

    David Holley wrote:
    > Actually, about an hour after I wrote that last response, the solution
    > presented itself - abeit its a SQL statement that will probably be about
    > a furlong in length. Haven't created it yet, but at least I know what
    > direction to go. Will post back.
    >
    > David H
    >
    > [url]www.gatewayorlando.com[/url]
    >
    > *** Sent via Devdex [url]http://www.devdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!
    David C. Holley Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139