Re: Stored procedure to set defaults

From: Cindy Winegarden (cindy.winegarden_at_mvps.org)
Date: 09/10/04

  • Next message: Faraz Khan: "URGENT: FoxPro COM Object"
    Date: Fri, 10 Sep 2004 18:18:36 -0400
    
    

    Hi TA,

    AFields() will give you an array of field names, types, etc. You can iterate
    through the array and build a command to set your values.

    Are you working against Fox data or some other kind? The default value for
    character and memo types is a blank string, the default for dates is {}
    (empty) and the default for numeric types is 0. In other words, if you
    append a new record to a Fox table you'll probably get what you want
    automatically.

    -- 
    Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP
    cindy.winegarden@mvps.org  www.cindywinegarden.com
    "TA" <nospam.Tar@hotmail.com> wrote in message 
    news:%23xnbMX3lEHA.2884@TK2MSFTNGP09.phx.gbl...
    >I dont know the basis of stored procedure.. maybe you can give me some
    > hints..
    >
    > "Dan Freeman" <spam@microsoft.com> wrote in message
    > news:uKOIYR3lEHA.3432@TK2MSFTNGP14.phx.gbl...
    >> You should look up Type() in the help file.
    >>
    >> But you may be working a little too hard. Take a look at AFIELDS() while
    >> you're in there. <g>
    >>
    >> Dan
    >>
    >> TA wrote:
    >> > I have this stored procedure that sets defaults to blank strings for
    >> > all the columns in a table. I have some date columns in this table
    >> > also, how would I identify that the column is data or integer or
    >> > double or char..
    >> >
    >> > PROCEDURE DefaultsALL
    >> > USE qtk EXCLUSIVE
    >> > FOR i = 1 TO FCOUNT()
    >> >    fieldname = FIELD(i)
    >> >       ALTER TABLE Qtk ALTER COLUMN (fieldname) set default ' '
    >> > ENDFOR
    >> > ENDPROC
    >>
    >>
    >
    > 
    

  • Next message: Faraz Khan: "URGENT: FoxPro COM Object"

    Relevant Pages

    • Re: rpgle, pcml & arrays
      ... allocation. ... If the program allocates memory on demand to store the array, ... SQL provides a way for a stored procedure to return a result set. ...
      (comp.sys.ibm.as400.misc)
    • Re: Passing arrays to a stored procedure
      ... sql developers around the world and Joe your attitude was quite frankly rude ... I am also writing a stored procedure and have to put an array of values into ... > into scalars. ...
      (microsoft.public.sqlserver.programming)
    • Re: rpgle, pcml & arrays
      ... can construct result set from a query or from an array. ... look at the SET RESULT SETS FOR CURSOR statement. ... SQL or in a store procedure in SQL stored procedure statements. ... doesn't support dynamic lenght parameters in the invoked ile code. ...
      (comp.sys.ibm.as400.misc)
    • Passing VARBINARY/BINARY param to a stored proc
      ... VARBINARY parameter in an SQL Server 2000 stored procedure. ... Value is an array. ... Dim Proc As Command ...
      (microsoft.public.data.ado)
    • Re: making a local variable available
      ... 1- Make aFields a member variable, declaring it outside any method and ... > arraylist and using the resulting array 'aFields'? ... > //Define maxRow to equal the upper bound of the aFields array ...
      (microsoft.public.dotnet.languages.csharp)